Skip to content

Commit 6999145

Browse files
Terraform Team Automationsahilg11
authored andcommitted
Added - BDS - Support for New Compute Shapes
1 parent 1848f5f commit 6999145

File tree

6 files changed

+147
-53
lines changed

6 files changed

+147
-53
lines changed

examples/big_data_service/main.tf

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ variable "bds_instance_nodes_shape" {
7777
}
7878

7979
variable "bds_instance_worker_node_shape" {
80-
default = "VM.Standard2.1"
80+
default = "BM.Standard.E4.128"
8181
}
8282

8383
variable "bds_instance_compute_only_worker_node_shape" {
@@ -96,13 +96,15 @@ variable "bds_instance_state" {
9696
default = "ACTIVE"
9797
}
9898

99-
variable "tag_namespace_description" {
100-
default = "Just a test"
101-
}
99+
#Uncomment this when running in home region (PHX)
100+
#variable "tag_namespace_description" {
101+
# default = "Just a test"
102+
#}
102103

103-
variable "tag_namespace_name" {
104-
default = "testexamples-tag-namespace"
105-
}
104+
#Uncomment this when running in home region (PHX)
105+
#variable "tag_namespace_name" {
106+
# default = "testexamples-tag-namespace"
107+
#}
106108

107109
provider "oci" {
108110
tenancy_ocid = var.tenancy_ocid
@@ -112,19 +114,21 @@ provider "oci" {
112114
region = var.region
113115
}
114116

115-
resource "oci_identity_tag_namespace" "tag-namespace1" {
116-
#Required
117-
compartment_id = var.tenancy_ocid
118-
description = var.tag_namespace_description
119-
name = var.tag_namespace_name
120-
}
117+
#Uncomment this when running in home region (PHX)
118+
#resource "oci_identity_tag_namespace" "tag-namespace1" {
119+
# #Required
120+
# compartment_id = var.tenancy_ocid
121+
# description = var.tag_namespace_description
122+
# name = var.tag_namespace_name
123+
#}
121124

122-
resource "oci_identity_tag" "tag1" {
123-
#Required
124-
description = "tf example tag"
125-
name = "tf-example-tag"
126-
tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id
127-
}
125+
#Uncomment this when running in home region (PHX)
126+
#resource "oci_identity_tag" "tag1" {
127+
# #Required
128+
# description = "tf example tag"
129+
# name = "tf-example-tag"
130+
# tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id
131+
#}
128132

129133
resource "oci_core_vcn" "vcn_bds" {
130134
cidr_block = "111.111.0.0/16"
@@ -203,9 +207,10 @@ resource "oci_bds_bds_instance" "test_bds_instance" {
203207
is_cloud_sql_configured = false
204208

205209
#Optional
206-
defined_tags = {
207-
"${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}" = var.bds_instance_defined_tags_value
208-
}
210+
#Uncomment this when running in home region (PHX)
211+
# defined_tags = {
212+
# "${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}" = var.bds_instance_defined_tags_value
213+
# }
209214
freeform_tags = var.bds_instance_freeform_tags
210215
network_config {
211216
#Optional

internal/integrationtest/bds_odh_instance_resource_test.go

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ var (
6666
"kms_key_id": acctest.Representation{RepType: acctest.Optional, Create: `${var.kms_key_id}`, Update: `${var.kms_key_id_for_update}`},
6767
//"cloud_sql_details": acctest.RepresentationGroup{RepType: acctest.Optional, Group: bdsInstanceNodesOdhCloudSqlRepresentation}, // capacity issue
6868

69-
"defined_tags": acctest.Representation{RepType: acctest.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")}`},
69+
//Uncomment this when running in home region (PHX)
70+
// "defined_tags": acctest.Representation{RepType: acctest.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")}`},
7071
"freeform_tags": acctest.Representation{RepType: acctest.Optional, Create: map[string]string{"bar-key": "value"}, Update: map[string]string{"Department": "Accounting"}},
7172
"network_config": acctest.RepresentationGroup{RepType: acctest.Optional, Group: bdsInstanceOdhNetworkConfigRepresentation},
7273
}
@@ -85,31 +86,32 @@ var (
8586
})
8687

8788
bdsInstanceNodesOdhCloudSqlRepresentation = map[string]interface{}{
88-
"shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard2.4`},
89+
"shape": acctest.Representation{RepType: acctest.Required, Create: `BM.Standard.E4.128`},
8990
"block_volume_size_in_gbs": acctest.Representation{RepType: acctest.Required, Create: `1000`},
91+
// "nvmes": acctest.Representation{RepType: acctest.Optional, Create: `10`}, // Only for VM_DenseIO_E4_Flex. The shape is disabled for now
9092
}
9193

9294
bdsInstanceNodesOdhMasterRepresentation = map[string]interface{}{
9395
"shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard2.4`},
94-
"subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_subnet.test_subnet.id}`},
96+
"subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${var.subnet_id}`},
9597
"block_volume_size_in_gbs": acctest.Representation{RepType: acctest.Required, Create: `150`},
9698
"number_of_nodes": acctest.Representation{RepType: acctest.Required, Create: `2`},
9799
}
98100
bdsInstanceNodesOdhUtilRepresentation = map[string]interface{}{
99101
"shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard2.4`},
100-
"subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_subnet.test_subnet.id}`},
102+
"subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${var.subnet_id}`},
101103
"block_volume_size_in_gbs": acctest.Representation{RepType: acctest.Required, Create: `150`},
102104
"number_of_nodes": acctest.Representation{RepType: acctest.Required, Create: `2`},
103105
}
104106
bdsInstanceNodesOdhWorkerRepresentation = map[string]interface{}{
105-
"shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard2.1`},
106-
"subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_subnet.test_subnet.id}`},
107+
"shape": acctest.Representation{RepType: acctest.Required, Create: `BM.Standard.E4.128`},
108+
"subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${var.subnet_id}`},
107109
"block_volume_size_in_gbs": acctest.Representation{RepType: acctest.Required, Create: `150`},
108110
"number_of_nodes": acctest.Representation{RepType: acctest.Required, Create: `3`, Update: `4`},
109111
}
110112
bdsInstanceNodeFlexShapeRepresentation = map[string]interface{}{
111113
"shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard.E4.Flex`},
112-
"subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_subnet.test_subnet.id}`},
114+
"subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${var.subnet_id}`},
113115
"block_volume_size_in_gbs": acctest.Representation{RepType: acctest.Required, Create: `150`},
114116
"number_of_nodes": acctest.Representation{RepType: acctest.Required, Create: `2`},
115117
"shape_config": acctest.RepresentationGroup{RepType: acctest.Required, Group: bdsInstanceNodesShapeConfigRepresentation},
@@ -132,7 +134,7 @@ var (
132134
[]string{"cidr_block", "dns_label"},
133135
[]interface{}{acctest.Representation{RepType: acctest.Required, Create: `111.111.0.0/16`}, acctest.Representation{RepType: acctest.Required, Create: `bdsvcn`}},
134136
CoreVcnRepresentation)) +
135-
DefinedTagsDependencies +
137+
// DefinedTagsDependencies +
136138
KeyResourceDependencyConfig
137139
)
138140

@@ -149,6 +151,9 @@ func TestResourceBdsOdhInstance(t *testing.T) {
149151
compartmentIdU := utils.GetEnvSettingWithDefault("compartment_id_for_update", compartmentId)
150152
compartmentIdUVariableStr := fmt.Sprintf("variable \"compartment_id_for_update\" { default = \"%s\" }\n", compartmentIdU)
151153

154+
subnetId := utils.GetEnvSettingWithBlankDefault("subnet_ocid")
155+
subnetIdVariableStr := fmt.Sprintf("variable \"subnet_id\" { default = \"%s\" }\n", subnetId)
156+
152157
kmsKeyId := utils.GetEnvSettingWithBlankDefault("kms_key_ocid")
153158
kmsKeyIdVariableStr := fmt.Sprintf("variable \"kms_key_id\" { default = \"%s\" }\n", kmsKeyId)
154159

@@ -170,7 +175,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
170175
acctest.ResourceTest(t, testAccCheckBdsBdsInstanceOdhDestroy, []resource.TestStep{
171176
// verify Create
172177
{
173-
Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr +
178+
Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr +
174179
acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Required, acctest.Create, bdsInstanceOdhRepresentation),
175180
Check: resource.ComposeAggregateTestCheckFunc(
176181
resource.TestCheckResourceAttr(resourceName, "cluster_admin_password", "T3JhY2xlVGVhbVVTQSExMjM="),
@@ -197,7 +202,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
197202
},
198203
// verify Create with optionals
199204
{
200-
Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr +
205+
Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr +
201206
acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Optional, acctest.Create, bdsInstanceOdhRepresentation),
202207
Check: resource.ComposeAggregateTestCheckFunc(
203208
resource.TestCheckResourceAttr(resourceName, "bootstrap_script_url", bootstrapScriptUrl),
@@ -245,7 +250,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
245250

246251
// verify Update to the compartment (the compartment will be switched back in the next step) and change shapes
247252
{
248-
Config: config + compartmentIdVariableStr + compartmentIdUVariableStr + kmsKeyIdVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhResourceDependencies +
253+
Config: config + compartmentIdVariableStr + compartmentIdUVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhResourceDependencies +
249254
acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Optional, acctest.Create,
250255
acctest.RepresentationCopyWithNewProperties(bdsInstanceOdhWithFlexComputeAndRegularMasterUtilRepresentation, map[string]interface{}{
251256
"compartment_id": acctest.Representation{RepType: acctest.Required, Create: `${var.compartment_id_for_update}`},
@@ -294,7 +299,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
294299

295300
// verify updates to updatable parameters, add a worker, update compute worker flex->regular, update util regular -> flex
296301
{
297-
Config: config + compartmentIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhResourceDependencies +
302+
Config: config + compartmentIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies +
298303
acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Optional, acctest.Update, bdsInstanceOdhWithRegularComputeAndFlexMasterUtilRepresentation),
299304
Check: resource.ComposeAggregateTestCheckFunc(
300305
resource.TestCheckResourceAttr(resourceName, "cluster_admin_password", "T3JhY2xlVGVhbVVTQSExMjM="),
@@ -327,10 +332,6 @@ func TestResourceBdsOdhInstance(t *testing.T) {
327332
resource.TestCheckResourceAttr(resourceName, "util_node.0.shape", "VM.Standard.E4.Flex"),
328333
resource.TestCheckResourceAttr(resourceName, "master_node.0.shape", "VM.Standard.E4.Flex"),
329334
resource.TestCheckResourceAttr(resourceName, "compute_only_worker_node.0.shape", "VM.Standard2.4"),
330-
// Change shape not supported for ODH on GA
331-
//resource.TestCheckResourceAttr(resourceName, "master_node.0.shape", "VM.Standard2.8"),
332-
//resource.TestCheckResourceAttr(resourceName, "worker_node.0.shape", "VM.Standard2.4"),
333-
//resource.TestCheckResourceAttr(resourceName, "util_node.0.shape", "VM.Standard2.8"),
334335

335336
func(s *terraform.State) (err error) {
336337
resId2, err = acctest.FromInstanceState(s, resourceName, "id")
@@ -345,7 +346,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
345346
{
346347
Config: config +
347348
acctest.GenerateDataSourceFromRepresentationMap("oci_bds_bds_instances", "test_bds_instances", acctest.Optional, acctest.Update, bdsInstanceOdhDataSourceRepresentation) +
348-
compartmentIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhResourceDependencies +
349+
compartmentIdVariableStr + kmsKeyIdUVariableStr + subnetIdVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhResourceDependencies +
349350
acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Optional, acctest.Update, bdsInstanceOdhWithRegularComputeAndFlexMasterUtilRepresentation),
350351
Check: resource.ComposeAggregateTestCheckFunc(
351352
resource.TestCheckResourceAttr(datasourceName, "compartment_id", compartmentId),
@@ -369,7 +370,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
369370
{
370371
Config: config +
371372
acctest.GenerateDataSourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Required, acctest.Create, bdsInstanceOdhSingularDataSourceRepresentation) +
372-
compartmentIdVariableStr + kmsKeyIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhWithRegularComputeWorkerResourceConfig,
373+
compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhWithRegularComputeWorkerResourceConfig,
373374
Check: resource.ComposeAggregateTestCheckFunc(
374375
resource.TestCheckResourceAttrSet(singularDatasourceName, "bds_instance_id"),
375376

internal/service/bds/bds_bds_instance_resource.go

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func BdsBdsInstanceResource() *schema.Resource {
9393

9494
"block_volume_size_in_gbs": {
9595
Type: schema.TypeString,
96-
Required: true,
96+
Optional: true,
9797
ForceNew: true,
9898
ValidateFunc: tfresource.ValidateInt64TypeString,
9999
DiffSuppressFunc: tfresource.Int64StringDiffSuppressFunction,
@@ -123,6 +123,12 @@ func BdsBdsInstanceResource() *schema.Resource {
123123
Type: schema.TypeInt,
124124
Optional: true,
125125
},
126+
"nvmes": {
127+
Type: schema.TypeInt,
128+
Optional: true,
129+
Computed: true,
130+
ForceNew: true,
131+
},
126132
},
127133
},
128134
},
@@ -150,7 +156,7 @@ func BdsBdsInstanceResource() *schema.Resource {
150156

151157
"block_volume_size_in_gbs": {
152158
Type: schema.TypeString,
153-
Required: true,
159+
Optional: true,
154160
ForceNew: true,
155161
ValidateFunc: tfresource.ValidateInt64TypeString,
156162
DiffSuppressFunc: tfresource.Int64StringDiffSuppressFunction,
@@ -180,6 +186,12 @@ func BdsBdsInstanceResource() *schema.Resource {
180186
Type: schema.TypeInt,
181187
Optional: true,
182188
},
189+
"nvmes": {
190+
Type: schema.TypeInt,
191+
Optional: true,
192+
Computed: true,
193+
ForceNew: true,
194+
},
183195
},
184196
},
185197
},
@@ -206,7 +218,7 @@ func BdsBdsInstanceResource() *schema.Resource {
206218

207219
"block_volume_size_in_gbs": {
208220
Type: schema.TypeString,
209-
Required: true,
221+
Optional: true,
210222
ValidateFunc: tfresource.ValidateInt64TypeString,
211223
DiffSuppressFunc: tfresource.Int64StringDiffSuppressFunction,
212224
},
@@ -235,6 +247,12 @@ func BdsBdsInstanceResource() *schema.Resource {
235247
Type: schema.TypeInt,
236248
Optional: true,
237249
},
250+
"nvmes": {
251+
Type: schema.TypeInt,
252+
Optional: true,
253+
Computed: true,
254+
ForceNew: true,
255+
},
238256

239257
// Computed
240258
},
@@ -263,7 +281,7 @@ func BdsBdsInstanceResource() *schema.Resource {
263281

264282
"block_volume_size_in_gbs": {
265283
Type: schema.TypeString,
266-
Required: true,
284+
Optional: true,
267285
ForceNew: true,
268286
ValidateFunc: tfresource.ValidateInt64TypeString,
269287
DiffSuppressFunc: tfresource.Int64StringDiffSuppressFunction,
@@ -293,6 +311,12 @@ func BdsBdsInstanceResource() *schema.Resource {
293311
Type: schema.TypeInt,
294312
Optional: true,
295313
},
314+
"nvmes": {
315+
Type: schema.TypeInt,
316+
Optional: true,
317+
Computed: true,
318+
ForceNew: true,
319+
},
296320

297321
// Computed
298322
},
@@ -317,9 +341,20 @@ func BdsBdsInstanceResource() *schema.Resource {
317341
// Required
318342
"block_volume_size_in_gbs": {
319343
Type: schema.TypeString,
320-
Required: true,
344+
Computed: true,
345+
},
346+
"memory_in_gbs": {
347+
Type: schema.TypeInt,
348+
Computed: true,
349+
},
350+
"nvmes": {
351+
Type: schema.TypeInt,
352+
Computed: true,
353+
},
354+
"ocpus": {
355+
Type: schema.TypeInt,
356+
Computed: true,
321357
},
322-
323358
"shape": {
324359
Type: schema.TypeString,
325360
Required: true,
@@ -1613,12 +1648,20 @@ func BdsNodeToMap(obj oci_bds.Node) map[string]interface{} {
16131648
result["ip_address"] = string(*obj.IpAddress)
16141649
}
16151650

1651+
if obj.LocalDisksTotalSizeInGBs != nil {
1652+
result["local_disks_total_size_in_gbs"] = float64(*obj.LocalDisksTotalSizeInGBs)
1653+
}
1654+
16161655
if obj.MemoryInGBs != nil {
16171656
result["memory_in_gbs"] = int(*obj.MemoryInGBs)
16181657
}
16191658

16201659
result["node_type"] = string(obj.NodeType)
16211660

1661+
if obj.Nvmes != nil {
1662+
result["nvmes"] = int(*obj.Nvmes)
1663+
}
1664+
16221665
if obj.Ocpus != nil {
16231666
result["ocpus"] = int(*obj.Ocpus)
16241667
}
@@ -1700,6 +1743,11 @@ func (s *BdsBdsInstanceResourceCrud) mapToShapeConfigDetails(fieldKeyFormat stri
17001743
result.MemoryInGBs = &tmp
17011744
}
17021745

1746+
if nvmes, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "nvmes")); ok {
1747+
tmp := nvmes.(int)
1748+
result.Nvmes = &tmp
1749+
}
1750+
17031751
if ocpus, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "ocpus")); ok {
17041752
tmp := ocpus.(int)
17051753
result.Ocpus = &tmp

website/docs/d/bds_bds_instance.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ The following attributes are exported:
8282
* `image_id` - The OCID of the image from which the node was created.
8383
* `instance_id` - The OCID of the underlying Oracle Cloud Infrastructure Compute instance.
8484
* `ip_address` - IP address of the node.
85+
* `local_disks_total_size_in_gbs` - The aggregate size of all local disks, in gigabytes. If the instance does not have any local disks, this field is null.
8586
* `memory_in_gbs` - The total amount of memory available to the node, in gigabytes.
8687
* `node_type` - Cluster node type.
88+
* `nvmes` - The number of NVMe drives to be used for storage. A single drive has 6.8 TB available.
8789
* `ocpus` - The total number of OCPUs available to the node.
8890
* `shape` - Shape of the node.
8991
* `ssh_fingerprint` - The fingerprint of the SSH key used for node access.

website/docs/d/bds_bds_instances.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ The following attributes are exported:
9595
* `image_id` - The OCID of the image from which the node was created.
9696
* `instance_id` - The OCID of the underlying Oracle Cloud Infrastructure Compute instance.
9797
* `ip_address` - IP address of the node.
98+
* `local_disks_total_size_in_gbs` - The aggregate size of all local disks, in gigabytes. If the instance does not have any local disks, this field is null.
9899
* `memory_in_gbs` - The total amount of memory available to the node, in gigabytes.
99100
* `node_type` - Cluster node type.
101+
* `nvmes` - The number of NVMe drives to be used for storage. A single drive has 6.8 TB available.
100102
* `ocpus` - The total number of OCPUs available to the node.
101103
* `shape` - Shape of the node.
102104
* `ssh_fingerprint` - The fingerprint of the SSH key used for node access.

0 commit comments

Comments
 (0)