Skip to content

Commit 3675df4

Browse files
committed
aws_odb_cloud_vm_cluster: add test for variable validation
1 parent 36deb3e commit 3675df4

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

internal/service/odb/cloud_vm_cluster_test.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,31 @@ func TestAccODBCloudVmCluster_usingARN(t *testing.T) {
332332
})
333333
}
334334

335+
func TestAccODBCloudVmCluster_variables(t *testing.T) {
336+
ctx := acctest.Context(t)
337+
if testing.Short() {
338+
t.Skip("skipping long-running test in short mode")
339+
}
340+
341+
vmcDisplayName := sdkacctest.RandomWithPrefix(vmClusterTestEntity.vmClusterDisplayNamePrefix)
342+
resource.ParallelTest(t, resource.TestCase{
343+
PreCheck: func() {
344+
acctest.PreCheck(ctx, t)
345+
vmClusterTestEntity.testAccPreCheck(ctx, t)
346+
},
347+
ErrorCheck: acctest.ErrorCheck(t, names.ODBServiceID),
348+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
349+
CheckDestroy: vmClusterTestEntity.testAccCheckCloudVmClusterDestroy(ctx),
350+
Steps: []resource.TestStep{
351+
{
352+
Config: testAccCloudVmClusterConfig_useVariables(vmcDisplayName),
353+
PlanOnly: true,
354+
ExpectNonEmptyPlan: true,
355+
},
356+
},
357+
})
358+
}
359+
335360
func (cloudVmClusterResourceTest) testAccCheckCloudVmClusterDestroy(ctx context.Context) resource.TestCheckFunc {
336361
return func(s *terraform.State) error {
337362
conn := acctest.Provider.Meta().(*conns.AWSClient).ODBClient(ctx)
@@ -383,6 +408,43 @@ func (cloudVmClusterResourceTest) testAccPreCheck(ctx context.Context, t *testin
383408
}
384409
}
385410

411+
func testAccCloudVmClusterConfig_useVariables(rName string) string {
412+
return fmt.Sprintf(`
413+
variable cloud_exadata_infrastructure_id {
414+
default = "exa_gjrmtxl4qk"
415+
type = string
416+
description = "ODB Exadata Infrastructure Resource ID"
417+
418+
}
419+
variable odb_network_id {
420+
default = "odbnet_3l9st3litg"
421+
type = string
422+
description = "ODB Network"
423+
}
424+
425+
resource "aws_odb_cloud_vm_cluster" "test" {
426+
display_name = %[1]q
427+
cloud_exadata_infrastructure_id = var.cloud_exadata_infrastructure_id
428+
cpu_core_count = 6
429+
gi_version = "23.0.0.0"
430+
hostname_prefix = "apollo12"
431+
ssh_public_keys = ["public-ssh-key"]
432+
odb_network_id = var.odb_network_id
433+
is_local_backup_enabled = true
434+
is_sparse_diskgroup_enabled = true
435+
license_model = "LICENSE_INCLUDED"
436+
data_storage_size_in_tbs = 20.0
437+
db_servers = ["db-server-1", "db-server-2"]
438+
db_node_storage_size_in_gbs = 120.0
439+
memory_size_in_gbs = 60
440+
data_collection_options {
441+
is_diagnostics_events_enabled = false
442+
is_health_monitoring_enabled = false
443+
is_incident_logs_enabled = false
444+
}
445+
}
446+
`, rName)
447+
}
386448
func (cloudVmClusterResourceTest) testAccCloudVmClusterConfigBasic(vmClusterDisplayName, sshKey string) (string, string) {
387449
exaInfraDisplayName := sdkacctest.RandomWithPrefix(vmClusterTestEntity.exaInfraDisplayNamePrefix)
388450
odbNetDisplayName := sdkacctest.RandomWithPrefix(vmClusterTestEntity.odbNetDisplayNamePrefix)

0 commit comments

Comments
 (0)