@@ -15,31 +15,25 @@ variable "compartment_ocid" {}
1515
1616variable subnet_id {}
1717
18- variable "instance_image_ocid" {
19- type = map (string )
20-
21- default = {
22- # See https://docs.us-phoenix-1.oraclecloud.com/images/
23- # Oracle-provided image "Oracle-Linux-7.5-2018.10.16-0"
24- }
25- }
18+ variable "instance_image_ocid" {}
2619
2720locals {
2821 # For resource "oci_core_dedicated_vm_host" "test_dedicated_vm_host"
29- dvh_shape = " DVH.DenseIO .E4.128"
22+ dvh_shape = " DVH.Standard .E4.128"
3023 dvh_display_name = " TestDedicatedVmHost"
24+ capacity_config = " standard_e4_flex"
25+ is_memory_encryption_enabled = " true"
3126
3227 # For resource "oci_core_instance" "test_instance"
33- vmi_display_name = " TestInstance"
34- vmi_shape = " VM.DenseIO.E4.Flex"
35- instance_shape_config_memory_in_gbs = " 128"
36- instance_shape_config_ocpus = " 8"
37- instance_shape_config_nvmes = " 1"
28+ vmi_display_name = " TestInstance"
29+ vmi_shape = " VM.Standard.E4.Flex"
30+ instance_shape_config_memory_in_gbs = " 16"
31+ instance_shape_config_ocpus = " 1"
3832
3933 # For data "oci_core_dedicated_vm_hosts" "test_dedicated_vm_hosts"
4034 dvh_lifecycle_state = " ACTIVE"
41- remaining_memory_in_gbs_greater_than_or_equal_to = " 512 .0"
42- remaining_ocpus_greater_than_or_equal_to = " 32 .0"
35+ remaining_memory_in_gbs_greater_than_or_equal_to = " 1 .0"
36+ remaining_ocpus_greater_than_or_equal_to = " 1 .0"
4337
4438 # For data "oci_core_subnet" "test_subnet"
4539 subnet_id = var. subnet_id
@@ -53,12 +47,12 @@ provider "oci" {
5347 fingerprint = var. fingerprint
5448 private_key_path = var. private_key_path
5549 region = var. region
56- # version = "7.1 .0"
50+ # version = "7.22 .0"
5751}
5852
5953data "oci_identity_availability_domain" "ad" {
6054 compartment_id = var. tenancy_ocid
61- ad_number = 1
55+ ad_number = 1
6256}
6357
6458resource "oci_core_dedicated_vm_host" "test_dedicated_vm_host" {
@@ -69,6 +63,8 @@ resource "oci_core_dedicated_vm_host" "test_dedicated_vm_host" {
6963
7064 # Optional
7165 display_name = local. dvh_display_name
66+ capacity_config = local. capacity_config
67+ is_memory_encryption_enabled = local. is_memory_encryption_enabled
7268
7369 timeouts {
7470 create = " 60m"
@@ -90,7 +86,6 @@ resource "oci_core_instance" "test_instance" {
9086 shape_config {
9187 memory_in_gbs = local. instance_shape_config_memory_in_gbs
9288 ocpus = local. instance_shape_config_ocpus
93- nvmes = local. instance_shape_config_nvmes
9489 }
9590 instance_options {
9691 are_legacy_imds_endpoints_disabled = true
@@ -108,13 +103,18 @@ resource "oci_core_instance" "test_instance" {
108103
109104 source_details {
110105 source_type = " image"
111- source_id = var. instance_image_ocid [ var . region ]
106+ source_id = var. instance_image_ocid
112107 # Apply this to set the size of the boot volume that's created for this instance.
113108 # Otherwise, the default boot volume size of the image is used.
114109 # This should only be specified when source_type is set to "image".
115110 # boot_volume_size_in_gbs = "60"
116111 }
117112
113+ platform_config {
114+ type = " AMD_VM"
115+ is_memory_encryption_enabled = true
116+ }
117+
118118 timeouts {
119119 create = " 60m"
120120 }
@@ -131,6 +131,8 @@ data "oci_core_dedicated_vm_hosts" "test_dedicated_vm_hosts" {
131131 # Optional
132132 availability_domain = data. oci_identity_availability_domain . ad . name
133133 display_name = local. dvh_display_name
134+ is_memory_encryption_enabled = local. is_memory_encryption_enabled
135+
134136 instance_shape_name = local. vmi_shape
135137 remaining_memory_in_gbs_greater_than_or_equal_to = local. remaining_memory_in_gbs_greater_than_or_equal_to
136138 remaining_ocpus_greater_than_or_equal_to = local. remaining_ocpus_greater_than_or_equal_to
@@ -159,20 +161,36 @@ data "oci_core_dedicated_vm_host" "test_oci_core_dedicated_vm_host" {
159161 dedicated_vm_host_id = oci_core_dedicated_vm_host. test_dedicated_vm_host . id
160162}
161163
162- # output the dedicated vm host ids
164+ data "oci_core_dedicated_vm_hosts_instances" "test_dedicated_vm_hosts_instances" {
165+ # Required
166+ compartment_id = var. compartment_ocid
167+ dedicated_vm_host_id = oci_core_dedicated_vm_host. test_dedicated_vm_host . id
168+
169+ # Optional
170+ availability_domain = data. oci_identity_availability_domain . ad . name
171+ }
172+
173+ # output of List DVHs
163174output "dedicated_host_ids" {
164- value = [ data . oci_core_dedicated_vm_hosts . test_dedicated_vm_hosts . id ]
175+ value = data. oci_core_dedicated_vm_hosts . test_dedicated_vm_hosts . id
165176}
166177
167- # output the dedicated vm host ids
178+ # output of List DVH Shapes
168179output "dedicated_host_shapes" {
169- value = [ data . oci_core_dedicated_vm_host_shapes . test_dedicated_vm_host_shapes . dedicated_vm_host_shapes ]
180+ value = data. oci_core_dedicated_vm_host_shapes . test_dedicated_vm_host_shapes . dedicated_vm_host_shapes
170181}
171182
183+ # output of List DVH Instance Shapes
172184output "dedicated_vm_host_instance_shapes" {
173- value = [data . oci_core_dedicated_vm_host_instance_shapes . test_dedicated_vm_host_instance_shapes . dedicated_vm_host_instance_shapes ]
185+ value = data. oci_core_dedicated_vm_host_instance_shapes . test_dedicated_vm_host_instance_shapes . dedicated_vm_host_instance_shapes
186+ }
187+
188+ # output of List DVH Instances
189+ output "dedicated_vm_host_instances_data" {
190+ value = data. oci_core_dedicated_vm_hosts_instances . test_dedicated_vm_hosts_instances . dedicated_vm_host_instances
174191}
175192
193+ # output of Get DVH
176194output "dedicated_vm_host_data" {
177- value = [ data . oci_core_dedicated_vm_host . test_oci_core_dedicated_vm_host . * ]
178- }
195+ value = data. oci_core_dedicated_vm_host . test_oci_core_dedicated_vm_host . *
196+ }
0 commit comments