diff --git a/driver/copy_ami_driver_test.go b/driver/copy_ami_driver_test.go index b08096f0..cba4b669 100644 --- a/driver/copy_ami_driver_test.go +++ b/driver/copy_ami_driver_test.go @@ -82,7 +82,7 @@ var _ = Describe("CopyAmiDriver", func() { Context("when kms_key_id is provided", func() { It("encrypts destination AMI using the kms key in the destination region", func() { - destinationRegionKmsKeyId := strings.Replace(multiregionKmsKeyId, creds.Region, destinationRegion, 1) + destinationRegionKmsKeyId := strings.ReplaceAll(multiRegionKey, creds.Region, destinationRegion) copyAmi( AmiCopyConfig{ amiId: privateAmiFixtureID, @@ -102,7 +102,7 @@ var _ = Describe("CopyAmiDriver", func() { Context("when shared_with_accounts is provided", func() { It("shares the AMI with other accounts", func() { - destinationRegionKmsKeyId := strings.Replace(multiregionKmsKeyId, creds.Region, destinationRegion, 1) + destinationRegionKmsKeyId := strings.ReplaceAll(multiRegionKey, creds.Region, destinationRegion) copyAmi(AmiCopyConfig{ amiId: privateAmiFixtureID, encrypted: true, diff --git a/driver/driver_suite_test.go b/driver/driver_suite_test.go index 9aae34af..354f276f 100644 --- a/driver/driver_suite_test.go +++ b/driver/driver_suite_test.go @@ -20,7 +20,7 @@ var ebsVolumeID, ebsSnapshotID string var machineImagePath, machineImageFormat string var s3MachineImageUrl, s3MachineImageFormat string -var kmsKeyId, multiregionKmsKeyId string +var kmsKeyId, multiRegionKey, multiRegionKeyReplicationTest string var awsAccount string @@ -78,8 +78,11 @@ var _ = SynchronizedBeforeSuite( kmsKeyId = os.Getenv("AWS_KMS_KEY_ID") Expect(kmsKeyId).ToNot(BeEmpty(), "AWS_KMS_KEY_ID must be set") - multiregionKmsKeyId = os.Getenv("MULTI_REGION_AWS_KMS_KEY_ID") - Expect(multiregionKmsKeyId).ToNot(BeEmpty(), "MULTI_REGION_AWS_KMS_KEY_ID must be set") + multiRegionKey = os.Getenv("MULTI_REGION_KEY") + Expect(multiRegionKey).ToNot(BeEmpty(), "MULTI_REGION_KEY must be set") + + multiRegionKeyReplicationTest = os.Getenv("MULTI_REGION_KEY_REPLICATION_TEST") + Expect(multiRegionKeyReplicationTest).ToNot(BeEmpty(), "MULTI_REGION_KEY_REPLICATION_TEST must be set") awsAccount = os.Getenv("AWS_ACCOUNT") Expect(awsAccount).ToNot(BeEmpty(), "AWS_ACCOUNT must be set") diff --git a/driver/kms_driver_test.go b/driver/kms_driver_test.go index 691c96a6..a7840eb2 100644 --- a/driver/kms_driver_test.go +++ b/driver/kms_driver_test.go @@ -58,7 +58,7 @@ var _ = Describe("KmsDriver", func() { It("replicates a given kms key to another region", func() { driverConfig := resources.KmsReplicateKeyDriverConfig{ - KmsKeyId: multiregionKmsKeyId, + KmsKeyId: multiRegionKeyReplicationTest, SourceRegion: creds.Region, TargetRegion: destinationRegion, } @@ -74,7 +74,7 @@ var _ = Describe("KmsDriver", func() { //defer cleanup of the created key replica, sadly we can only schedule it to be deleted after 7 days //therefore this test will reuse the replicated key for 7 days and only afterward create a new one defer func(aliasCreationResult resources.KmsKey) { - destinationKeyId := strings.ReplaceAll(kmsKeyId, originalRegion, destinationRegion) + destinationKeyId := strings.ReplaceAll(multiRegionKeyReplicationTest, originalRegion, destinationRegion) awsSession, _ := session.NewSession(creds.GetAwsConfig()) kmsClient := kms.New(awsSession)