Skip to content

Commit 48506a2

Browse files
Terraform Team Automationrashik-bhasin
authored andcommitted
Added - Platform Config support for AMD Milan GPU
1 parent 23fdd26 commit 48506a2

20 files changed

+201
-57
lines changed

internal/integrationtest/core_instance_resource_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ var (
3838
"is_secure_boot_enabled": acctest.Representation{RepType: acctest.Required, Create: `true`},
3939
"is_symmetric_multi_threading_enabled": acctest.Representation{RepType: acctest.Required, Create: `false`},
4040
"is_trusted_platform_module_enabled": acctest.Representation{RepType: acctest.Required, Create: `true`},
41-
"numa_nodes_per_socket": acctest.Representation{RepType: acctest.Required, Create: `NPS1`},
42-
"percentage_of_cores_enabled": acctest.Representation{RepType: acctest.Required, Create: `25`},
41+
"numa_nodes_per_socket": acctest.Representation{RepType: acctest.Required, Create: `NPS4`},
42+
"percentage_of_cores_enabled": acctest.Representation{RepType: acctest.Required, Create: `50`},
4343
}
4444
instanceBMRomeShieldedPlatformConfigRepresentation = map[string]interface{}{
4545
"type": acctest.Representation{RepType: acctest.Required, Create: `AMD_ROME_BM`},
@@ -1689,8 +1689,8 @@ func TestAccResourceCoreInstance_BM_Milan_instance_resource(t *testing.T) {
16891689
resource.TestCheckResourceAttr(resourceName, "platform_config.0.is_secure_boot_enabled", "true"),
16901690
resource.TestCheckResourceAttr(resourceName, "platform_config.0.is_symmetric_multi_threading_enabled", "false"),
16911691
resource.TestCheckResourceAttr(resourceName, "platform_config.0.is_trusted_platform_module_enabled", "true"),
1692-
resource.TestCheckResourceAttr(resourceName, "platform_config.0.numa_nodes_per_socket", "NPS1"),
1693-
resource.TestCheckResourceAttr(resourceName, "platform_config.0.percentage_of_cores_enabled", "25"),
1692+
resource.TestCheckResourceAttr(resourceName, "platform_config.0.numa_nodes_per_socket", "NPS4"),
1693+
resource.TestCheckResourceAttr(resourceName, "platform_config.0.percentage_of_cores_enabled", "50"),
16941694

16951695
func(ts *terraform.State) (err error) {
16961696
return err
@@ -1715,8 +1715,8 @@ func TestAccResourceCoreInstance_BM_Milan_instance_resource(t *testing.T) {
17151715
resource.TestCheckResourceAttr(datasourceName, "instances.0.platform_config.0.is_secure_boot_enabled", "true"),
17161716
resource.TestCheckResourceAttr(datasourceName, "instances.0.platform_config.0.is_symmetric_multi_threading_enabled", "false"),
17171717
resource.TestCheckResourceAttr(datasourceName, "instances.0.platform_config.0.is_trusted_platform_module_enabled", "true"),
1718-
resource.TestCheckResourceAttr(datasourceName, "instances.0.platform_config.0.numa_nodes_per_socket", "NPS1"),
1719-
resource.TestCheckResourceAttr(datasourceName, "instances.0.platform_config.0.percentage_of_cores_enabled", "25"),
1718+
resource.TestCheckResourceAttr(datasourceName, "instances.0.platform_config.0.numa_nodes_per_socket", "NPS4"),
1719+
resource.TestCheckResourceAttr(datasourceName, "instances.0.platform_config.0.percentage_of_cores_enabled", "50"),
17201720
),
17211721
},
17221722
// verify singular datasource
@@ -1763,8 +1763,8 @@ func TestAccResourceCoreInstance_BM_Milan_instance_resource(t *testing.T) {
17631763
resource.TestCheckResourceAttr(singularDatasourceName, "platform_config.0.is_secure_boot_enabled", "true"),
17641764
resource.TestCheckResourceAttr(singularDatasourceName, "platform_config.0.is_symmetric_multi_threading_enabled", "false"),
17651765
resource.TestCheckResourceAttr(singularDatasourceName, "platform_config.0.is_trusted_platform_module_enabled", "true"),
1766-
resource.TestCheckResourceAttr(singularDatasourceName, "platform_config.0.numa_nodes_per_socket", "NPS1"),
1767-
resource.TestCheckResourceAttr(singularDatasourceName, "platform_config.0.percentage_of_cores_enabled", "25"),
1766+
resource.TestCheckResourceAttr(singularDatasourceName, "platform_config.0.numa_nodes_per_socket", "NPS4"),
1767+
resource.TestCheckResourceAttr(singularDatasourceName, "platform_config.0.percentage_of_cores_enabled", "50"),
17681768
resource.TestCheckResourceAttr(singularDatasourceName, "platform_config.0.type", "AMD_MILAN_BM"),
17691769
),
17701770
},

internal/integrationtest/core_instance_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ resource "oci_core_instance" "test_instance" {
149149
data "oci_kms_keys" "test_keys_dependency" {
150150
#Required
151151
compartment_id = "${var.tenancy_ocid}"
152-
management_endpoint = "${var.management_endpoint}"
152+
management_endpoint = "${data.oci_kms_vault.test_vault.management_endpoint}"
153153
algorithm = "AES"
154154
155155
filter {
@@ -160,7 +160,7 @@ data "oci_kms_keys" "test_keys_dependency" {
160160
data "oci_kms_keys" "test_keys_dependency_RSA" {
161161
#Required
162162
compartment_id = "${var.tenancy_ocid}"
163-
management_endpoint = "${var.management_endpoint}"
163+
management_endpoint = "${data.oci_kms_vault.test_vault.management_endpoint}"
164164
algorithm = "RSA"
165165
166166
filter {

internal/service/core/core_instance_configuration_resource.go

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ func CoreInstanceConfigurationResource() *schema.Resource {
661661
DiffSuppressFunc: tfresource.EqualIgnoreCaseSuppressDiff,
662662
ValidateFunc: validation.StringInSlice([]string{
663663
"AMD_MILAN_BM",
664+
"AMD_MILAN_BM_GPU",
664665
"AMD_ROME_BM",
665666
"AMD_ROME_BM_GPU",
666667
"AMD_VM",
@@ -1797,7 +1798,7 @@ func (s *CoreInstanceConfigurationResourceCrud) mapToInstanceConfigurationInstan
17971798
if ok {
17981799
instanceType = instanceTypeRaw.(string)
17991800
} else {
1800-
instanceType = "" // default value
1801+
instanceType = "compute" // default value
18011802
}
18021803
switch strings.ToLower(instanceType) {
18031804
case strings.ToLower("compute"):
@@ -2385,6 +2386,44 @@ func (s *CoreInstanceConfigurationResourceCrud) mapToInstanceConfigurationLaunch
23852386
details.IsTrustedPlatformModuleEnabled = &tmp
23862387
}
23872388
baseObject = details
2389+
case strings.ToLower("AMD_MILAN_BM_GPU"):
2390+
details := oci_core.InstanceConfigurationAmdMilanBmGpuLaunchInstancePlatformConfig{}
2391+
if areVirtualInstructionsEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "are_virtual_instructions_enabled")); ok {
2392+
tmp := areVirtualInstructionsEnabled.(bool)
2393+
details.AreVirtualInstructionsEnabled = &tmp
2394+
}
2395+
if isAccessControlServiceEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_access_control_service_enabled")); ok {
2396+
tmp := isAccessControlServiceEnabled.(bool)
2397+
details.IsAccessControlServiceEnabled = &tmp
2398+
}
2399+
if isInputOutputMemoryManagementUnitEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_input_output_memory_management_unit_enabled")); ok {
2400+
tmp := isInputOutputMemoryManagementUnitEnabled.(bool)
2401+
details.IsInputOutputMemoryManagementUnitEnabled = &tmp
2402+
}
2403+
if isSymmetricMultiThreadingEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_symmetric_multi_threading_enabled")); ok {
2404+
tmp := isSymmetricMultiThreadingEnabled.(bool)
2405+
details.IsSymmetricMultiThreadingEnabled = &tmp
2406+
}
2407+
if numaNodesPerSocket, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "numa_nodes_per_socket")); ok {
2408+
details.NumaNodesPerSocket = oci_core.InstanceConfigurationAmdMilanBmGpuLaunchInstancePlatformConfigNumaNodesPerSocketEnum(numaNodesPerSocket.(string))
2409+
}
2410+
if isMeasuredBootEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_measured_boot_enabled")); ok {
2411+
tmp := isMeasuredBootEnabled.(bool)
2412+
details.IsMeasuredBootEnabled = &tmp
2413+
}
2414+
if isMemoryEncryptionEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_memory_encryption_enabled")); ok {
2415+
tmp := isMemoryEncryptionEnabled.(bool)
2416+
details.IsMemoryEncryptionEnabled = &tmp
2417+
}
2418+
if isSecureBootEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_secure_boot_enabled")); ok {
2419+
tmp := isSecureBootEnabled.(bool)
2420+
details.IsSecureBootEnabled = &tmp
2421+
}
2422+
if isTrustedPlatformModuleEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_trusted_platform_module_enabled")); ok {
2423+
tmp := isTrustedPlatformModuleEnabled.(bool)
2424+
details.IsTrustedPlatformModuleEnabled = &tmp
2425+
}
2426+
baseObject = details
23882427
case strings.ToLower("AMD_ROME_BM"):
23892428
details := oci_core.InstanceConfigurationAmdRomeBmLaunchInstancePlatformConfig{}
23902429
if areVirtualInstructionsEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "are_virtual_instructions_enabled")); ok {
@@ -2589,6 +2628,26 @@ func InstanceConfigurationLaunchInstancePlatformConfigToMap(obj *oci_core.Instan
25892628
if v.PercentageOfCoresEnabled != nil {
25902629
result["percentage_of_cores_enabled"] = int(*v.PercentageOfCoresEnabled)
25912630
}
2631+
case oci_core.InstanceConfigurationAmdMilanBmGpuLaunchInstancePlatformConfig:
2632+
result["type"] = "AMD_MILAN_BM_GPU"
2633+
2634+
if v.AreVirtualInstructionsEnabled != nil {
2635+
result["are_virtual_instructions_enabled"] = bool(*v.AreVirtualInstructionsEnabled)
2636+
}
2637+
2638+
if v.IsAccessControlServiceEnabled != nil {
2639+
result["is_access_control_service_enabled"] = bool(*v.IsAccessControlServiceEnabled)
2640+
}
2641+
2642+
if v.IsInputOutputMemoryManagementUnitEnabled != nil {
2643+
result["is_input_output_memory_management_unit_enabled"] = bool(*v.IsInputOutputMemoryManagementUnitEnabled)
2644+
}
2645+
2646+
if v.IsSymmetricMultiThreadingEnabled != nil {
2647+
result["is_symmetric_multi_threading_enabled"] = bool(*v.IsSymmetricMultiThreadingEnabled)
2648+
}
2649+
2650+
result["numa_nodes_per_socket"] = string(v.NumaNodesPerSocket)
25922651
case oci_core.InstanceConfigurationAmdRomeBmLaunchInstancePlatformConfig:
25932652
result["type"] = "AMD_ROME_BM"
25942653

internal/service/core/core_instance_resource.go

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ func CoreInstanceResource() *schema.Resource {
398398
DiffSuppressFunc: tfresource.EqualIgnoreCaseSuppressDiff,
399399
ValidateFunc: validation.StringInSlice([]string{
400400
"AMD_MILAN_BM",
401+
"AMD_MILAN_BM_GPU",
401402
"AMD_ROME_BM",
402403
"AMD_ROME_BM_GPU",
403404
"AMD_VM",
@@ -2051,6 +2052,44 @@ func (s *CoreInstanceResourceCrud) mapToLaunchInstancePlatformConfig(fieldKeyFor
20512052
details.IsTrustedPlatformModuleEnabled = &tmp
20522053
}
20532054
baseObject = details
2055+
case strings.ToLower("AMD_MILAN_BM_GPU"):
2056+
details := oci_core.AmdMilanBmGpuLaunchInstancePlatformConfig{}
2057+
if areVirtualInstructionsEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "are_virtual_instructions_enabled")); ok {
2058+
tmp := areVirtualInstructionsEnabled.(bool)
2059+
details.AreVirtualInstructionsEnabled = &tmp
2060+
}
2061+
if isAccessControlServiceEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_access_control_service_enabled")); ok {
2062+
tmp := isAccessControlServiceEnabled.(bool)
2063+
details.IsAccessControlServiceEnabled = &tmp
2064+
}
2065+
if isInputOutputMemoryManagementUnitEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_input_output_memory_management_unit_enabled")); ok {
2066+
tmp := isInputOutputMemoryManagementUnitEnabled.(bool)
2067+
details.IsInputOutputMemoryManagementUnitEnabled = &tmp
2068+
}
2069+
if isSymmetricMultiThreadingEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_symmetric_multi_threading_enabled")); ok {
2070+
tmp := isSymmetricMultiThreadingEnabled.(bool)
2071+
details.IsSymmetricMultiThreadingEnabled = &tmp
2072+
}
2073+
if numaNodesPerSocket, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "numa_nodes_per_socket")); ok {
2074+
details.NumaNodesPerSocket = oci_core.AmdMilanBmGpuLaunchInstancePlatformConfigNumaNodesPerSocketEnum(numaNodesPerSocket.(string))
2075+
}
2076+
if isMeasuredBootEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_measured_boot_enabled")); ok {
2077+
tmp := isMeasuredBootEnabled.(bool)
2078+
details.IsMeasuredBootEnabled = &tmp
2079+
}
2080+
if isMemoryEncryptionEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_memory_encryption_enabled")); ok {
2081+
tmp := isMemoryEncryptionEnabled.(bool)
2082+
details.IsMemoryEncryptionEnabled = &tmp
2083+
}
2084+
if isSecureBootEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_secure_boot_enabled")); ok {
2085+
tmp := isSecureBootEnabled.(bool)
2086+
details.IsSecureBootEnabled = &tmp
2087+
}
2088+
if isTrustedPlatformModuleEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "is_trusted_platform_module_enabled")); ok {
2089+
tmp := isTrustedPlatformModuleEnabled.(bool)
2090+
details.IsTrustedPlatformModuleEnabled = &tmp
2091+
}
2092+
baseObject = details
20542093
case strings.ToLower("AMD_ROME_BM"):
20552094
details := oci_core.AmdRomeBmLaunchInstancePlatformConfig{}
20562095
if areVirtualInstructionsEnabled, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "are_virtual_instructions_enabled")); ok {
@@ -2268,6 +2307,42 @@ func PlatformConfigToMap(obj *oci_core.PlatformConfig) map[string]interface{} {
22682307
result["is_secure_boot_enabled"] = bool(*v.IsSecureBootEnabled)
22692308
}
22702309

2310+
if v.IsTrustedPlatformModuleEnabled != nil {
2311+
result["is_trusted_platform_module_enabled"] = bool(*v.IsTrustedPlatformModuleEnabled)
2312+
}
2313+
case oci_core.AmdMilanBmGpuPlatformConfig:
2314+
result["type"] = "AMD_MILAN_BM_GPU"
2315+
2316+
if v.AreVirtualInstructionsEnabled != nil {
2317+
result["are_virtual_instructions_enabled"] = bool(*v.AreVirtualInstructionsEnabled)
2318+
}
2319+
2320+
if v.IsAccessControlServiceEnabled != nil {
2321+
result["is_access_control_service_enabled"] = bool(*v.IsAccessControlServiceEnabled)
2322+
}
2323+
2324+
if v.IsInputOutputMemoryManagementUnitEnabled != nil {
2325+
result["is_input_output_memory_management_unit_enabled"] = bool(*v.IsInputOutputMemoryManagementUnitEnabled)
2326+
}
2327+
2328+
if v.IsSymmetricMultiThreadingEnabled != nil {
2329+
result["is_symmetric_multi_threading_enabled"] = bool(*v.IsSymmetricMultiThreadingEnabled)
2330+
}
2331+
2332+
result["numa_nodes_per_socket"] = string(v.NumaNodesPerSocket)
2333+
2334+
if v.IsMeasuredBootEnabled != nil {
2335+
result["is_measured_boot_enabled"] = bool(*v.IsMeasuredBootEnabled)
2336+
}
2337+
2338+
if v.IsMemoryEncryptionEnabled != nil {
2339+
result["is_memory_encryption_enabled"] = bool(*v.IsMemoryEncryptionEnabled)
2340+
}
2341+
2342+
if v.IsSecureBootEnabled != nil {
2343+
result["is_secure_boot_enabled"] = bool(*v.IsSecureBootEnabled)
2344+
}
2345+
22712346
if v.IsTrustedPlatformModuleEnabled != nil {
22722347
result["is_trusted_platform_module_enabled"] = bool(*v.IsTrustedPlatformModuleEnabled)
22732348
}

website/docs/d/core_cluster_network.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The following attributes are exported:
6767
Example: `[FAULT-DOMAIN-1, FAULT-DOMAIN-2, FAULT-DOMAIN-3]`
6868
* `primary_subnet_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the primary subnet to place instances.
6969
* `secondary_vnic_subnets` - The set of secondary VNIC data for instances in the pool.
70-
* `display_name` - The display name of the VNIC. This is also use to match against the instance configuration defined secondary VNIC.
70+
* `display_name` - The display name of the VNIC. This is also used to match against the instance configuration defined secondary VNIC.
7171
* `subnet_id` - The subnet [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the secondary VNIC.
7272
* `size` - The number of instances that should be in the instance pool.
7373
* `state` - The current state of the instance pool.
@@ -76,7 +76,7 @@ The following attributes are exported:
7676
* `availability_domain` - The availability domain to place instances. Example: `Uocm:PHX-AD-1`
7777
* `primary_subnet_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the primary subnet to place instances.
7878
* `secondary_vnic_subnets` - The set of secondary VNIC data for instances in the pool.
79-
* `display_name` - The display name of the VNIC. This is also use to match against the instance configuration defined secondary VNIC.
79+
* `display_name` - The display name of the VNIC. This is also used to match against the instance configuration defined secondary VNIC.
8080
* `subnet_id` - The subnet [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the secondary VNIC.
8181
* `state` - The current state of the cluster network.
8282
* `time_created` - The date and time the resource was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: `2016-08-25T21:10:29.600Z`

website/docs/d/core_cluster_networks.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The following attributes are exported:
7979
Example: `[FAULT-DOMAIN-1, FAULT-DOMAIN-2, FAULT-DOMAIN-3]`
8080
* `primary_subnet_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the primary subnet to place instances.
8181
* `secondary_vnic_subnets` - The set of secondary VNIC data for instances in the pool.
82-
* `display_name` - The display name of the VNIC. This is also use to match against the instance configuration defined secondary VNIC.
82+
* `display_name` - The display name of the VNIC. This is also used to match against the instance configuration defined secondary VNIC.
8383
* `subnet_id` - The subnet [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the secondary VNIC.
8484
* `size` - The number of instances that should be in the instance pool.
8585
* `state` - The current state of the instance pool.
@@ -88,7 +88,7 @@ The following attributes are exported:
8888
* `availability_domain` - The availability domain to place instances. Example: `Uocm:PHX-AD-1`
8989
* `primary_subnet_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the primary subnet to place instances.
9090
* `secondary_vnic_subnets` - The set of secondary VNIC data for instances in the pool.
91-
* `display_name` - The display name of the VNIC. This is also use to match against the instance configuration defined secondary VNIC.
91+
* `display_name` - The display name of the VNIC. This is also used to match against the instance configuration defined secondary VNIC.
9292
* `subnet_id` - The subnet [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) for the secondary VNIC.
9393
* `state` - The current state of the cluster network.
9494
* `time_created` - The date and time the resource was created, in the format defined by [RFC3339](https://tools.ietf.org/html/rfc3339). Example: `2016-08-25T21:10:29.600Z`

website/docs/d/core_instance.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ The following attributes are exported:
6868
* `boot_volume_id` - The OCID of the attached boot volume. If the `source_type` is `bootVolume`, this will be the same OCID as the `source_id`.
6969
* `capacity_reservation_id` - The OCID of the compute capacity reservation this instance is launched under. When this field contains an empty string or is null, the instance is not currently in a capacity reservation. For more information, see [Capacity Reservations](https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/reserve-capacity.htm#default).
7070
* `compartment_id` - The OCID of the compartment that contains the instance.
71-
* `dedicated_vm_host_id` - The OCID of dedicated VM host.
71+
* `dedicated_vm_host_id` - The OCID of the dedicated virtual machine host that the instance is placed on.
7272
* `defined_tags` - Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Operations.CostCenter": "42"}`
7373
* `display_name` - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
7474
* `extended_metadata` - Additional metadata key/value pairs that you provide. They serve the same purpose and functionality as fields in the `metadata` object.

0 commit comments

Comments
 (0)