Skip to content

Commit 9236594

Browse files
committed
add example for create instance from image
1 parent a451bbf commit 9236594

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

examples/compute/image/image.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,29 @@ output "supported_shape_images" {
154154
value = data.oci_core_images.supported_shape_images.images
155155
}
156156

157+
resource "oci_core_instance" "test_instance_from_image" {
158+
availability_domain = data.oci_identity_availability_domain.ad.name
159+
compartment_id = var.compartment_ocid
160+
display_name = "TestInstanceImage"
161+
shape = "VM.Standard2.1"
162+
163+
create_vnic_details {
164+
subnet_id = oci_core_subnet.test_subnet.id
165+
display_name = "Primaryvnic"
166+
assign_public_ip = true
167+
hostname_label = "testimage"
168+
}
169+
170+
source_details {
171+
source_type = "image"
172+
source_id = oci_core_image.custom_image.id
173+
}
174+
175+
metadata = {
176+
ssh_authorized_keys = var.ssh_public_key
177+
}
178+
179+
timeouts {
180+
create = "60m"
181+
}
182+
}

0 commit comments

Comments
 (0)