Skip to content

Commit 0087a92

Browse files
committed
fix(backup-vaults-access-policies): change vault policy override to match the documented solution
The previous policy was not allowing cross-account assumed roles to update/delete the policy. This change resolves the issue by setting the policy to the AWS documented example (https://repost.aws/knowledge-center/efs-disable-automatic-backups).
1 parent 65a7282 commit 0087a92

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

resources/backup-vaults-access-policies.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ func (l *AWSBackupVaultAccessPolicyLister) List(_ context.Context, o interface{}
6060
if resp.Policy != nil {
6161
resources = append(resources, &BackupVaultAccessPolicy{
6262
svc: svc,
63+
accountID: opts.AccountID,
6364
backupVaultName: *out.BackupVaultName,
6465
})
6566
}
@@ -70,6 +71,7 @@ func (l *AWSBackupVaultAccessPolicyLister) List(_ context.Context, o interface{}
7071

7172
type BackupVaultAccessPolicy struct {
7273
svc *backup.Backup
74+
accountID *string
7375
backupVaultName string
7476
}
7577

@@ -111,7 +113,7 @@ func (b *BackupVaultAccessPolicy) Remove(_ context.Context) error {
111113
{
112114
"Effect": "Allow",
113115
"Principal": {
114-
"AWS": "*"
116+
"AWS": "arn:aws:iam::` + *b.accountID + `:root"
115117
},
116118
"Action": "backup:DeleteBackupVaultAccessPolicy",
117119
"Resource": "*"

0 commit comments

Comments
 (0)