Skip to content

Commit 4c02bef

Browse files
r/aws_backup_logically_air_gapped_vault: test for attr
1 parent 67d741f commit 4c02bef

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

internal/service/backup/logically_air_gapped_vault_test.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,39 @@ func TestAccBackupLogicallyAirGappedVault_disappears(t *testing.T) {
8888
})
8989
}
9090

91+
func TestAccBackupLogicallyAirGappedVault_encryptionKeyArn(t *testing.T) {
92+
ctx := acctest.Context(t)
93+
var v backup.DescribeBackupVaultOutput
94+
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
95+
resourceName := "aws_backup_logically_air_gapped_vault.test"
96+
kmsKeyResourceName := "aws_kms_key.test"
97+
98+
resource.ParallelTest(t, resource.TestCase{
99+
PreCheck: func() {
100+
acctest.PreCheck(ctx, t)
101+
acctest.PreCheckPartitionHasService(t, names.BackupEndpointID)
102+
testAccPreCheck(ctx, t)
103+
},
104+
ErrorCheck: acctest.ErrorCheck(t, names.BackupServiceID),
105+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
106+
CheckDestroy: testAccCheckLogicallyAirGappedVaultDestroy(ctx),
107+
Steps: []resource.TestStep{
108+
{
109+
Config: testAccLogicallyAirGappedVaultConfig_encryptionKeyArn(rName),
110+
Check: resource.ComposeTestCheckFunc(
111+
testAccCheckLogicallyAirGappedVaultExists(ctx, resourceName, &v),
112+
resource.TestCheckResourceAttrPair(resourceName, "encryption_key_arn", kmsKeyResourceName, names.AttrARN),
113+
),
114+
},
115+
{
116+
ResourceName: resourceName,
117+
ImportState: true,
118+
ImportStateVerify: true,
119+
},
120+
},
121+
})
122+
}
123+
91124
func TestAccBackupLogicallyAirGappedVault_tags(t *testing.T) {
92125
ctx := acctest.Context(t)
93126
var v backup.DescribeBackupVaultOutput
@@ -202,6 +235,22 @@ resource "aws_backup_logically_air_gapped_vault" "test" {
202235
`, rName)
203236
}
204237

238+
func testAccLogicallyAirGappedVaultConfig_encryptionKeyArn(rName string) string {
239+
return fmt.Sprintf(`
240+
resource "aws_kms_key" "test" {
241+
description = %[1]q
242+
deletion_window_in_days = 7
243+
}
244+
245+
resource "aws_backup_logically_air_gapped_vault" "test" {
246+
name = %[1]q
247+
max_retention_days = 10
248+
min_retention_days = 7
249+
encryption_key_arn = aws_kms_key.test.arn
250+
}
251+
`, rName)
252+
}
253+
205254
func testAccLogicallyAirGappedVaultConfig_tags1(rName, tagKey1, tagValue1 string) string {
206255
return fmt.Sprintf(`
207256
resource "aws_backup_logically_air_gapped_vault" "test" {

0 commit comments

Comments
 (0)