|
53 | 53 | "values": acctest.Representation{RepType: acctest.Required, Create: []string{`${oci_bds_bds_instance.test_bds_instance.id}`}}, |
54 | 54 | } |
55 | 55 |
|
| 56 | + BdsBdsInstanceNetworkConfigRepresentation = map[string]interface{}{ |
| 57 | + "cidr_block": acctest.Representation{RepType: acctest.Optional, Create: `111.112.0.0/16`}, |
| 58 | + "is_nat_gateway_required": acctest.Representation{RepType: acctest.Optional, Create: `true`}, |
| 59 | + } |
56 | 60 | BdsBdsInstanceNodesRepresentation = map[string]interface{}{ |
57 | 61 | "shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard2.1`, Update: `VM.Standard2.4`}, |
58 | 62 | "subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_subnet.test_subnet.id}`}, |
@@ -118,12 +122,6 @@ var ( |
118 | 122 | "compute_only_worker_node": acctest.RepresentationGroup{RepType: acctest.Required, Group: bdsInstanceNodesOdhUtilRepresentation}, // Regular util shape representation usable for compute worker |
119 | 123 | }) |
120 | 124 |
|
121 | | - bdsInstanceNodesOdhCloudSqlRepresentation = map[string]interface{}{ |
122 | | - "shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard2.4`}, |
123 | | - "block_volume_size_in_gbs": acctest.Representation{RepType: acctest.Required, Create: `1000`}, |
124 | | - // "nvmes": acctest.Representation{RepType: acctest.Optional, Create: `10`}, // Only for VM_DenseIO_E4_Flex. The shape is disabled for now |
125 | | - } |
126 | | - |
127 | 125 | bdsInstanceNodesOdhMasterRepresentation = map[string]interface{}{ |
128 | 126 | "shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard2.4`}, |
129 | 127 | "subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${var.subnet_id}`}, |
@@ -198,17 +196,7 @@ var ( |
198 | 196 | "shape_config": acctest.RepresentationGroup{RepType: acctest.Required, Group: bdsInstanceNodesShapeConfigRepresentation}, |
199 | 197 | } |
200 | 198 |
|
201 | | - BdsInstanceOdhResourceDependencies = acctest.GenerateResourceFromRepresentationMap("oci_core_subnet", "test_subnet", acctest.Required, acctest.Create, |
202 | | - acctest.GetMultipleUpdatedRepresenationCopy( |
203 | | - []string{"cidr_block", "dns_label"}, |
204 | | - []interface{}{acctest.Representation{RepType: acctest.Required, Create: `111.111.0.0/24`}, acctest.Representation{RepType: acctest.Required, Create: `bdssubnet`}}, |
205 | | - subnetRegionalRepresentation)) + |
206 | | - acctest.GenerateResourceFromRepresentationMap("oci_core_vcn", "test_vcn", acctest.Required, acctest.Create, acctest.GetMultipleUpdatedRepresenationCopy( |
207 | | - []string{"cidr_block", "dns_label"}, |
208 | | - []interface{}{acctest.Representation{RepType: acctest.Required, Create: `111.111.0.0/16`}, acctest.Representation{RepType: acctest.Required, Create: `bdsvcn`}}, |
209 | | - CoreVcnRepresentation)) + |
210 | | - // DefinedTagsDependencies + |
211 | | - KeyResourceDependencyConfig |
| 199 | + BdsInstanceOdhResourceDependencies = KeyResourceDependencyConfig |
212 | 200 | ) |
213 | 201 |
|
214 | 202 | // issue-routing-tag: bds/default |
@@ -276,10 +264,12 @@ func TestResourceBdsOdhInstance(t *testing.T) { |
276 | 264 | }, |
277 | 265 | ), |
278 | 266 | }, |
| 267 | + |
279 | 268 | // delete before next Create |
280 | 269 | { |
281 | 270 | Config: config + compartmentIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr, |
282 | 271 | }, |
| 272 | + |
283 | 273 | // verify Create, cluster will be force stopped after create |
284 | 274 | { |
285 | 275 | Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + |
@@ -331,123 +321,12 @@ func TestResourceBdsOdhInstance(t *testing.T) { |
331 | 321 | resource.TestCheckResourceAttr(resourceName, "state", "ACTIVE"), |
332 | 322 | ), |
333 | 323 | }, |
334 | | - // delete before next Create |
335 | | - { |
336 | | - Config: config + compartmentIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr, |
337 | | - }, |
338 | | - // Create cluster with HADOOP_EXTENDED |
339 | | - { |
340 | | - Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + |
341 | | - acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Optional, acctest.Create, |
342 | | - acctest.RepresentationCopyWithNewProperties(bdsInstanceOdhRepresentation, map[string]interface{}{ |
343 | | - "cluster_profile": acctest.Representation{RepType: acctest.Optional, Create: `HADOOP_EXTENDED`}, |
344 | | - "display_name": acctest.Representation{RepType: acctest.Required, Create: `hadext1`, Update: `hadext1`}, |
345 | | - })), |
346 | | - Check: resource.ComposeAggregateTestCheckFunc( |
347 | | - resource.TestCheckResourceAttr(resourceName, "cluster_admin_password", "T3JhY2xlVGVhbVVTQSExMjM="), |
348 | | - resource.TestCheckResourceAttrSet(resourceName, "cluster_public_key"), |
349 | | - resource.TestCheckResourceAttr(resourceName, "cluster_version", "ODH1"), |
350 | | - resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId), |
351 | | - resource.TestCheckResourceAttr(resourceName, "is_high_availability", "true"), |
352 | | - resource.TestCheckResourceAttr(resourceName, "is_secure", "true"), |
353 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.node_type"), |
354 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.shape"), |
355 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.subnet_id"), |
356 | | - resource.TestCheckResourceAttr(resourceName, "state", "ACTIVE"), |
357 | 324 |
|
358 | | - func(s *terraform.State) (err error) { |
359 | | - resId, err = acctest.FromInstanceState(s, resourceName, "id") |
360 | | - return err |
361 | | - }, |
362 | | - ), |
363 | | - }, |
364 | | - // Add Kafka to cluster |
365 | | - { |
366 | | - Config: config + compartmentIdVariableStr + compartmentIdUVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + kmsKeyIdUVariableStr + |
367 | | - acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Optional, acctest.Update, |
368 | | - acctest.RepresentationCopyWithNewProperties(bdsInstanceOdhRepresentation, map[string]interface{}{ |
369 | | - "is_kafka_configured": acctest.Representation{RepType: acctest.Required, Create: `false`, Update: `true`}, |
370 | | - "cluster_profile": acctest.Representation{RepType: acctest.Optional, Create: `HADOOP_EXTENDED`, Update: `HADOOP_EXTENDED`}, |
371 | | - "display_name": acctest.Representation{RepType: acctest.Required, Create: `hadext1`, Update: `hadext1`}, |
372 | | - "kafka_broker_node": acctest.RepresentationGroup{RepType: acctest.Required, Group: bdsInstanceKafkaBrokerNodeFlexShapeRepresentation}, |
373 | | - })), |
374 | | - Check: resource.ComposeAggregateTestCheckFunc( |
375 | | - resource.TestCheckResourceAttr(resourceName, "cluster_admin_password", "T3JhY2xlVGVhbVVTQSExMjM="), |
376 | | - resource.TestCheckResourceAttrSet(resourceName, "cluster_public_key"), |
377 | | - resource.TestCheckResourceAttr(resourceName, "cluster_version", "ODH1"), |
378 | | - resource.TestCheckResourceAttr(resourceName, "is_high_availability", "true"), |
379 | | - resource.TestCheckResourceAttr(resourceName, "is_secure", "true"), |
380 | | - resource.TestCheckResourceAttr(resourceName, "is_kafka_configured", "true"), |
381 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.node_type"), |
382 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.shape"), |
383 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.subnet_id"), |
384 | | - resource.TestCheckResourceAttr(resourceName, "state", "ACTIVE"), |
385 | | - ), |
386 | | - }, |
387 | | - // Remove Kafka to cluster |
388 | | - { |
389 | | - Config: config + compartmentIdVariableStr + compartmentIdUVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + kmsKeyIdUVariableStr + |
390 | | - acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Optional, acctest.Update, |
391 | | - acctest.RepresentationCopyWithNewProperties(bdsInstanceOdhRepresentation, map[string]interface{}{ |
392 | | - "is_kafka_configured": acctest.Representation{RepType: acctest.Required, Create: `false`, Update: `false`}, |
393 | | - "cluster_profile": acctest.Representation{RepType: acctest.Optional, Create: `HADOOP_EXTENDED`, Update: `HADOOP_EXTENDED`}, |
394 | | - "display_name": acctest.Representation{RepType: acctest.Required, Create: `hadext1`, Update: `hadext1`}, |
395 | | - })), |
396 | | - Check: resource.ComposeAggregateTestCheckFunc( |
397 | | - resource.TestCheckResourceAttr(resourceName, "cluster_admin_password", "T3JhY2xlVGVhbVVTQSExMjM="), |
398 | | - resource.TestCheckResourceAttrSet(resourceName, "cluster_public_key"), |
399 | | - resource.TestCheckResourceAttr(resourceName, "cluster_version", "ODH1"), |
400 | | - resource.TestCheckResourceAttr(resourceName, "is_high_availability", "true"), |
401 | | - resource.TestCheckResourceAttr(resourceName, "is_secure", "true"), |
402 | | - resource.TestCheckResourceAttr(resourceName, "is_kafka_configured", "false"), |
403 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.node_type"), |
404 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.shape"), |
405 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.subnet_id"), |
406 | | - resource.TestCheckResourceAttr(resourceName, "state", "ACTIVE"), |
407 | | - ), |
408 | | - }, |
409 | 325 | // delete before next Create |
410 | 326 | { |
411 | 327 | Config: config + compartmentIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr, |
412 | 328 | }, |
413 | | - // verify Create with required fields Kafka cluster |
414 | | - { |
415 | | - Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + |
416 | | - acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Required, acctest.Create, |
417 | | - acctest.RepresentationCopyWithNewProperties(bdsInstanceOdhRepresentation, map[string]interface{}{ |
418 | | - "is_kafka_configured": acctest.Representation{RepType: acctest.Required, Create: `false`, Update: `false`}, |
419 | | - "cluster_profile": acctest.Representation{RepType: acctest.Optional, Create: `KAFKA`, Update: `HADOOP_EXTENDED`}, |
420 | | - "display_name": acctest.Representation{RepType: acctest.Required, Create: `kafkacluster`, Update: `kafkacluster`}, |
421 | | - "kafka_broker_node": acctest.RepresentationGroup{RepType: acctest.Required, Group: bdsInstanceKafkaBrokerNodeFlexShapeRepresentation}, |
422 | | - })), |
423 | | - Check: resource.ComposeAggregateTestCheckFunc( |
424 | | - resource.TestCheckResourceAttr(resourceName, "cluster_admin_password", "T3JhY2xlVGVhbVVTQSExMjM="), |
425 | | - resource.TestCheckResourceAttrSet(resourceName, "cluster_public_key"), |
426 | | - resource.TestCheckResourceAttr(resourceName, "cluster_version", "ODH1"), |
427 | | - resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId), |
428 | | - resource.TestCheckResourceAttr(resourceName, "is_high_availability", "true"), |
429 | | - resource.TestCheckResourceAttr(resourceName, "is_secure", "true"), |
430 | | - resource.TestCheckResourceAttr(resourceName, "is_kafka_configured", "false"), |
431 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.node_type"), |
432 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.shape"), |
433 | | - resource.TestCheckResourceAttrSet(resourceName, "nodes.0.subnet_id"), |
434 | | - |
435 | | - func(s *terraform.State) (err error) { |
436 | | - resId, err = acctest.FromInstanceState(s, resourceName, "id") |
437 | | - if isEnableExportCompartment, _ := strconv.ParseBool(utils.GetEnvSettingWithDefault("enable_export_compartment", "true")); isEnableExportCompartment { |
438 | | - if errExport := resourcediscovery.TestExportCompartmentWithResourceName(&resId, &compartmentId, resourceName); errExport != nil { |
439 | | - return errExport |
440 | | - } |
441 | | - } |
442 | | - return err |
443 | | - }, |
444 | | - ), |
445 | | - }, |
446 | 329 |
|
447 | | - // delete before next Create |
448 | | - { |
449 | | - Config: config + compartmentIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr, |
450 | | - }, |
451 | 330 | // verify Create with optionals |
452 | 331 | { |
453 | 332 | Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + |
@@ -500,6 +379,7 @@ func TestResourceBdsOdhInstance(t *testing.T) { |
500 | 379 | }, |
501 | 380 | ), |
502 | 381 | }, |
| 382 | + |
503 | 383 | // verify Update to the compartment (the compartment will be switched back in the next step) and change shapes |
504 | 384 | { |
505 | 385 | Config: config + compartmentIdVariableStr + compartmentIdUVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhResourceDependencies + |
@@ -553,6 +433,7 @@ func TestResourceBdsOdhInstance(t *testing.T) { |
553 | 433 | }, |
554 | 434 | ), |
555 | 435 | }, |
| 436 | + |
556 | 437 | // verify updates to updatable parameters, add a worker, update compute worker flex->regular, update util regular -> flex |
557 | 438 | { |
558 | 439 | Config: config + compartmentIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + |
|
0 commit comments