@@ -3363,6 +3363,46 @@ func TestAccRDSCluster_databaseInsightsMode_defaultKMSKey_create(t *testing.T) {
3363
3363
})
3364
3364
}
3365
3365
3366
+ func TestAccRDSCluster_GlobalClusterIdentifier_databaseInsightsMode_defaultKMSKey_create (t * testing.T ) {
3367
+ ctx := acctest .Context (t )
3368
+ if testing .Short () {
3369
+ t .Skip ("skipping long-running test in short mode" )
3370
+ }
3371
+
3372
+ var dbCluster types.DBCluster
3373
+ rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
3374
+ resourceName := "aws_rds_cluster.test"
3375
+
3376
+ kmsKeyIDExpectNoChange := statecheck .CompareValue (compare .ValuesSame ())
3377
+
3378
+ resource .ParallelTest (t , resource.TestCase {
3379
+ PreCheck : func () { acctest .PreCheck (ctx , t ) },
3380
+ ErrorCheck : acctest .ErrorCheck (t , names .RDSServiceID ),
3381
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
3382
+ CheckDestroy : testAccCheckClusterDestroy (ctx ),
3383
+ Steps : []resource.TestStep {
3384
+ {
3385
+ Config : testAccClusterConfig_GlobalClusterIdentifier_databaseInsightsMode_defaultKMSKey (rName , "advanced" , true , "465" ),
3386
+ Check : resource .ComposeTestCheckFunc (
3387
+ testAccCheckClusterExists (ctx , resourceName , & dbCluster ),
3388
+ ),
3389
+ ConfigPlanChecks : resource.ConfigPlanChecks {
3390
+ PreApply : []plancheck.PlanCheck {
3391
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionCreate ),
3392
+ },
3393
+ },
3394
+ ConfigStateChecks : []statecheck.StateCheck {
3395
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New ("database_insights_mode" ), knownvalue .StringExact ("advanced" )),
3396
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New ("performance_insights_enabled" ), knownvalue .Bool (true )),
3397
+ kmsKeyIDExpectNoChange .AddStateValue ("data.aws_kms_key.rds" , tfjsonpath .New (names .AttrARN )),
3398
+ kmsKeyIDExpectNoChange .AddStateValue (resourceName , tfjsonpath .New ("performance_insights_kms_key_id" )),
3399
+ statecheck .ExpectKnownValue (resourceName , tfjsonpath .New ("performance_insights_retention_period" ), knownvalue .Int64Exact (465 )),
3400
+ },
3401
+ },
3402
+ },
3403
+ })
3404
+ }
3405
+
3366
3406
func TestAccRDSCluster_databaseInsightsMode_defaultKMSKey_Disable_PerformanceInsightsEnabled (t * testing.T ) {
3367
3407
ctx := acctest .Context (t )
3368
3408
if testing .Short () {
@@ -7221,6 +7261,48 @@ data "aws_kms_key" "rds" {
7221
7261
` , rName , tfrds .ClusterEngineMySQL , databaseInsightsMode , performanceInsightsEnabled , performanceInsightsRetentionPeriod ))
7222
7262
}
7223
7263
7264
+ func testAccClusterConfig_GlobalClusterIdentifier_databaseInsightsMode_defaultKMSKey (rName , databaseInsightsMode string , performanceInsightsEnabled bool , performanceInsightsRetentionPeriod string ) string {
7265
+ if databaseInsightsMode != "null" {
7266
+ databaseInsightsMode = strconv .Quote (databaseInsightsMode )
7267
+ }
7268
+
7269
+ return acctest .ConfigCompose (
7270
+ testAccClusterConfig_clusterSubnetGroup (rName ),
7271
+ fmt .Sprintf (`
7272
+ resource "aws_rds_cluster" "test" {
7273
+ cluster_identifier = %[1]q
7274
+ global_cluster_identifier = aws_rds_global_cluster.test.global_cluster_identifier
7275
+
7276
+ engine = aws_rds_global_cluster.test.engine
7277
+ engine_version = aws_rds_global_cluster.test.engine_version
7278
+
7279
+ master_username = "tfacctest"
7280
+ master_password = "avoid-plaintext-passwords"
7281
+ skip_final_snapshot = true
7282
+ apply_immediately = true
7283
+ db_subnet_group_name = aws_db_subnet_group.test.name
7284
+
7285
+ database_insights_mode = %[3]s
7286
+ performance_insights_enabled = %[4]t
7287
+ performance_insights_retention_period = %[5]s
7288
+ }
7289
+
7290
+ data "aws_rds_engine_version" "test" {
7291
+ engine = "aurora-postgresql"
7292
+ }
7293
+
7294
+ resource "aws_rds_global_cluster" "test" {
7295
+ global_cluster_identifier = %[1]q
7296
+ engine = data.aws_rds_engine_version.test.engine
7297
+ engine_version = data.aws_rds_engine_version.test.version
7298
+ }
7299
+
7300
+ data "aws_kms_key" "rds" {
7301
+ key_id = "alias/aws/rds"
7302
+ }
7303
+ ` , rName , tfrds .ClusterEngineMySQL , databaseInsightsMode , performanceInsightsEnabled , performanceInsightsRetentionPeriod ))
7304
+ }
7305
+
7224
7306
func testAccClusterConfig_databaseInsightsMode_customKMSKey (rName , databaseInsightsMode string , performanceInsightsEnabled bool , performanceInsightsRetentionPeriod string ) string {
7225
7307
if databaseInsightsMode != "null" {
7226
7308
databaseInsightsMode = strconv .Quote (databaseInsightsMode )
0 commit comments