40 lines
1.4 KiB
Terraform
40 lines
1.4 KiB
Terraform
|
resource "oci_core_instance" "vm_instance_x86_64" {
|
||
|
count = 1
|
||
|
availability_domain = data.oci_identity_availability_domains.ads.availability_domains[1].name
|
||
|
compartment_id = oci_identity_compartment.tf-playground.id
|
||
|
shape = "VM.Standard.E2.1.Micro"
|
||
|
display_name = join("", [var.vm_name, "0", count.index + 1])
|
||
|
preserve_boot_volume = false
|
||
|
is_pv_encryption_in_transit_enabled = true
|
||
|
freeform_tags = var.tags
|
||
|
|
||
|
# lifecycle {
|
||
|
# prevent_destroy = true
|
||
|
# }
|
||
|
|
||
|
metadata = {
|
||
|
ssh_authorized_keys = var.ssh_public_key
|
||
|
}
|
||
|
|
||
|
source_details {
|
||
|
#source_id = var.vm_image_ocid_x86_64
|
||
|
source_id = data.oci_core_images.ubuntu-compute-image.images[0].id
|
||
|
source_type = "image"
|
||
|
boot_volume_size_in_gbs = 50
|
||
|
}
|
||
|
|
||
|
availability_config {
|
||
|
is_live_migration_preferred = true
|
||
|
}
|
||
|
|
||
|
create_vnic_details {
|
||
|
assign_public_ip = true
|
||
|
subnet_id = oci_core_subnet.vcn-public-subnet.id
|
||
|
assign_private_dns_record = true
|
||
|
hostname_label = join("", [var.vm_name, "0", count.index + 1])
|
||
|
private_ip = join(".", ["10", "0", "0", count.index + 4])
|
||
|
nsg_ids = [oci_core_network_security_group.tf-playground-network-security-group.id]
|
||
|
freeform_tags = var.tags
|
||
|
}
|
||
|
}
|