diff --git a/aws/resource_aws_rds_cluster_test.go b/aws/resource_aws_rds_cluster_test.go index 7f94bc6bcd9..8d8c66444b6 100644 --- a/aws/resource_aws_rds_cluster_test.go +++ b/aws/resource_aws_rds_cluster_test.go @@ -669,12 +669,12 @@ func TestAccAWSRDSCluster_copyTagsToSnapshot(t *testing.T) { }) } -func TestAccAWSRDSCluster_EncryptedCrossRegionReplication(t *testing.T) { +func TestAccAWSRDSCluster_ReplicationSourceIdentifier_KmsKeyId(t *testing.T) { var primaryCluster rds.DBCluster var replicaCluster rds.DBCluster resourceName := "aws_rds_cluster.test" resourceName2 := "aws_rds_cluster.alternate" - rInt := acctest.RandInt() + rName := acctest.RandomWithPrefix("tf-acc-test") // record the initialized providers so that we can use them to // check for the cluster in each region @@ -683,21 +683,20 @@ func TestAccAWSRDSCluster_EncryptedCrossRegionReplication(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) - testAccMultipleRegionsPreCheck(t) - testAccAlternateRegionPreCheck(t) + testAccMultipleRegionPreCheck(t, 2) }, ProviderFactories: testAccProviderFactories(&providers), CheckDestroy: testAccCheckWithProviders(testAccCheckAWSClusterDestroyWithProvider, &providers), Steps: []resource.TestStep{ { - Config: testAccAWSClusterConfigEncryptedCrossRegionReplica(rInt), + Config: testAccAWSClusterConfigReplicationSourceIdentifierKmsKeyId(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSClusterExistsWithProvider(resourceName, &primaryCluster, testAccAwsRegionProviderFunc(testAccGetRegion(), &providers)), testAccCheckAWSClusterExistsWithProvider(resourceName2, &replicaCluster, testAccAwsRegionProviderFunc(testAccGetAlternateRegion(), &providers)), ), }, { - Config: testAccAWSClusterConfigEncryptedCrossRegionReplica(rInt), + Config: testAccAWSClusterConfigReplicationSourceIdentifierKmsKeyId(rName), ResourceName: resourceName, ImportState: true, ImportStateVerify: true, @@ -2910,8 +2909,10 @@ resource "aws_rds_cluster" "test" { `, n, n, n) } -func testAccAWSClusterConfigEncryptedCrossRegionReplica(n int) string { - return testAccAlternateRegionProviderConfig() + fmt.Sprintf(` +func testAccAWSClusterConfigReplicationSourceIdentifierKmsKeyId(rName string) string { + return composeConfig( + testAccMultipleRegionProviderConfig(2), + fmt.Sprintf(` data "aws_availability_zones" "alternate" { provider = "awsalternate" @@ -2928,7 +2929,7 @@ data "aws_caller_identity" "current" {} data "aws_region" "current" {} resource "aws_rds_cluster_parameter_group" "test" { - name = "tf-aurora-prm-grp-%[1]d" + name = %[1]q family = "aurora5.6" description = "RDS default cluster parameter group" @@ -2940,7 +2941,7 @@ resource "aws_rds_cluster_parameter_group" "test" { } resource "aws_rds_cluster" "test" { - cluster_identifier = "tf-test-primary-%[1]d" + cluster_identifier = "%[1]s-primary" db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.test.name database_name = "mydb" master_username = "foo" @@ -2950,14 +2951,14 @@ resource "aws_rds_cluster" "test" { } resource "aws_rds_cluster_instance" "test" { - identifier = "tf-aurora-instance-%[1]d" + identifier = "%[1]s-primary" cluster_identifier = aws_rds_cluster.test.id instance_class = "db.t2.small" } resource "aws_kms_key" "alternate" { provider = "awsalternate" - description = "Terraform acc test %[1]d" + description = %[1]q policy = <