Skip to content

Commit c389448

Browse files
committed
support for specifying Fault Domains in launch_details for oci_core_instance_configuration resource
1 parent 9e783af commit c389448

6 files changed

+47
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Added
44
- Support for ATP-S autoscaling
5+
- Support for specifying Fault Domains in `launch_details` for `oci_core_instance_configuration` resource
56

67
## 3.27.0 (May 29, 2019)
78

oci/core_instance_configuration_resource.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,12 @@ func CoreInstanceConfigurationResource() *schema.Resource {
315315
ForceNew: true,
316316
Elem: schema.TypeString,
317317
},
318+
"fault_domain": {
319+
Type: schema.TypeString,
320+
Optional: true,
321+
Computed: true,
322+
ForceNew: true,
323+
},
318324
"freeform_tags": {
319325
Type: schema.TypeMap,
320326
Optional: true,
@@ -1225,6 +1231,11 @@ func (s *CoreInstanceConfigurationResourceCrud) mapToInstanceConfigurationLaunch
12251231
result.ExtendedMetadata = extendedMetadata
12261232
}
12271233

1234+
if faultDomain, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "fault_domain")); ok {
1235+
tmp := faultDomain.(string)
1236+
result.FaultDomain = &tmp
1237+
}
1238+
12281239
if freeformTags, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "freeform_tags")); ok {
12291240
result.FreeformTags = objectMapToStringMap(freeformTags.(map[string]interface{}))
12301241
}
@@ -1282,6 +1293,10 @@ func InstanceConfigurationLaunchInstanceDetailsToMap(obj *oci_core.InstanceConfi
12821293

12831294
result["extended_metadata"] = obj.ExtendedMetadata
12841295

1296+
if obj.FaultDomain != nil {
1297+
result["fault_domain"] = string(*obj.FaultDomain)
1298+
}
1299+
12851300
result["freeform_tags"] = obj.FreeformTags
12861301

12871302
if obj.IpxeScript != nil {

oci/core_instance_configuration_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ var (
6969
"defined_tags": Representation{repType: Optional, create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
7070
"display_name": Representation{repType: Optional, create: `backend-servers`},
7171
"extended_metadata": Representation{repType: Optional, create: map[string]string{"extendedMetadata": "extendedMetadata"}, update: map[string]string{"extendedMetadata2": "extendedMetadata2"}},
72+
"fault_domain": Representation{repType: Optional, create: `FAULT-DOMAIN-2`},
7273
"freeform_tags": Representation{repType: Optional, create: map[string]string{"Department": "Finance"}, update: map[string]string{"Department": "Accounting"}},
7374
"ipxe_script": Representation{repType: Optional, create: `ipxeScript`},
7475
"metadata": Representation{repType: Optional, create: map[string]string{"metadata": "metadata"}, update: map[string]string{"metadata2": "metadata2"}},
@@ -197,6 +198,7 @@ func TestCoreInstanceConfigurationResource_basic(t *testing.T) {
197198
resource.TestCheckResourceAttr(resourceName, "instance_details.0.launch_details.0.defined_tags.%", "1"),
198199
resource.TestCheckResourceAttr(resourceName, "instance_details.0.launch_details.0.display_name", "backend-servers"),
199200
resource.TestCheckResourceAttr(resourceName, "instance_details.0.launch_details.0.extended_metadata.%", "1"),
201+
resource.TestCheckResourceAttr(resourceName, "instance_details.0.launch_details.0.fault_domain", "FAULT-DOMAIN-2"),
200202
resource.TestCheckResourceAttr(resourceName, "instance_details.0.launch_details.0.freeform_tags.%", "1"),
201203
resource.TestCheckResourceAttr(resourceName, "instance_details.0.launch_details.0.ipxe_script", "ipxeScript"),
202204
resource.TestCheckResourceAttr(resourceName, "instance_details.0.launch_details.0.metadata.%", "1"),

website/docs/d/core_instance_configuration.html.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ The following attributes are exported:
7272
* `extended_metadata` - Additional metadata key/value pairs that you provide. They serve the same purpose and functionality as fields in the 'metadata' object.
7373

7474
They are distinguished from 'metadata' fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only).
75+
* `fault_domain` - A fault domain is a grouping of hardware and infrastructure within an availability domain. Each availability domain contains three fault domains. Fault domains let you distribute your instances so that they are not on the same physical hardware within a single availability domain. A hardware failure or Compute hardware maintenance that affects one fault domain does not affect instances in other fault domains.
76+
77+
If you do not specify the fault domain, the system selects one for you. To change the fault domain for an instance, terminate it and launch a new instance in the preferred fault domain.
78+
79+
To get a list of fault domains, use the [ListFaultDomains](https://docs.cloud.oracle.com/iaas/api/#/en/identity/20160918/FaultDomain/ListFaultDomains) operation in the Identity and Access Management Service API.
80+
81+
Example: `FAULT-DOMAIN-1`
7582
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
7683
* `ipxe_script` - This is an advanced option.
7784

website/docs/d/core_instance_configurations.html.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ The following attributes are exported:
7979
* `extended_metadata` - Additional metadata key/value pairs that you provide. They serve the same purpose and functionality as fields in the 'metadata' object.
8080

8181
They are distinguished from 'metadata' fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only).
82+
* `fault_domain` - A fault domain is a grouping of hardware and infrastructure within an availability domain. Each availability domain contains three fault domains. Fault domains let you distribute your instances so that they are not on the same physical hardware within a single availability domain. A hardware failure or Compute hardware maintenance that affects one fault domain does not affect instances in other fault domains.
83+
84+
If you do not specify the fault domain, the system selects one for you. To change the fault domain for an instance, terminate it and launch a new instance in the preferred fault domain.
85+
86+
To get a list of fault domains, use the [ListFaultDomains](https://docs.cloud.oracle.com/iaas/api/#/en/identity/20160918/FaultDomain/ListFaultDomains) operation in the Identity and Access Management Service API.
87+
88+
Example: `FAULT-DOMAIN-1`
8289
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
8390
* `ipxe_script` - This is an advanced option.
8491

website/docs/r/core_instance_configuration.html.markdown

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ resource "oci_core_instance_configuration" "test_instance_configuration" {
7373
defined_tags = {"Operations.CostCenter"= "42"}
7474
display_name = "${var.instance_configuration_instance_details_launch_details_display_name}"
7575
extended_metadata = "${var.instance_configuration_instance_details_launch_details_extended_metadata}"
76+
fault_domain = "${var.instance_configuration_instance_details_launch_details_fault_domain}"
7677
freeform_tags = {"Department"= "Finance"}
7778
ipxe_script = "${var.instance_configuration_instance_details_launch_details_ipxe_script}"
7879
metadata = "${var.instance_configuration_instance_details_launch_details_metadata}"
@@ -154,6 +155,13 @@ The following arguments are supported:
154155
* `extended_metadata` - (Optional) Additional metadata key/value pairs that you provide. They serve the same purpose and functionality as fields in the 'metadata' object.
155156

156157
They are distinguished from 'metadata' fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only).
158+
* `fault_domain` - (Optional) A fault domain is a grouping of hardware and infrastructure within an availability domain. Each availability domain contains three fault domains. Fault domains let you distribute your instances so that they are not on the same physical hardware within a single availability domain. A hardware failure or Compute hardware maintenance that affects one fault domain does not affect instances in other fault domains.
159+
160+
If you do not specify the fault domain, the system selects one for you. To change the fault domain for an instance, terminate it and launch a new instance in the preferred fault domain.
161+
162+
To get a list of fault domains, use the [ListFaultDomains](https://docs.cloud.oracle.com/iaas/api/#/en/identity/20160918/FaultDomain/ListFaultDomains) operation in the Identity and Access Management Service API.
163+
164+
Example: `FAULT-DOMAIN-1`
157165
* `freeform_tags` - (Optional) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
158166
* `ipxe_script` - (Optional) This is an advanced option.
159167

@@ -262,6 +270,13 @@ The following attributes are exported:
262270
* `extended_metadata` - Additional metadata key/value pairs that you provide. They serve the same purpose and functionality as fields in the 'metadata' object.
263271

264272
They are distinguished from 'metadata' fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only).
273+
* `fault_domain` - A fault domain is a grouping of hardware and infrastructure within an availability domain. Each availability domain contains three fault domains. Fault domains let you distribute your instances so that they are not on the same physical hardware within a single availability domain. A hardware failure or Compute hardware maintenance that affects one fault domain does not affect instances in other fault domains.
274+
275+
If you do not specify the fault domain, the system selects one for you. To change the fault domain for an instance, terminate it and launch a new instance in the preferred fault domain.
276+
277+
To get a list of fault domains, use the [ListFaultDomains](https://docs.cloud.oracle.com/iaas/api/#/en/identity/20160918/FaultDomain/ListFaultDomains) operation in the Identity and Access Management Service API.
278+
279+
Example: `FAULT-DOMAIN-1`
265280
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
266281
* `ipxe_script` - This is an advanced option.
267282

0 commit comments

Comments
 (0)