Skip to content

Commit a9cae71

Browse files
committed
fix(backup-vaults-access-policies): switch to sprintf
1 parent 0087a92 commit a9cae71

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

resources/backup-vaults-access-policies.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"github.com/ekristen/libnuke/pkg/registry"
88
"github.com/ekristen/libnuke/pkg/resource"
99

10+
"fmt"
11+
1012
"github.com/aws/aws-sdk-go/service/backup"
1113
)
1214

@@ -107,19 +109,19 @@ func (b *BackupVaultAccessPolicy) Remove(_ context.Context) error {
107109
//
108110
// While deletion is Denied, you can update the policy with one that
109111
// doesn't deny and then delete at will.
110-
allowDeletionPolicy := `{
111-
"Version": "2012-10-17",
112-
"Statement": [
113-
{
114-
"Effect": "Allow",
115-
"Principal": {
116-
"AWS": "arn:aws:iam::` + *b.accountID + `:root"
117-
},
118-
"Action": "backup:DeleteBackupVaultAccessPolicy",
119-
"Resource": "*"
120-
}
121-
]
122-
}`
112+
allowDeletionPolicy := fmt.Sprintf(`{
113+
"Version": "2012-10-17",
114+
"Statement": [
115+
{
116+
"Effect": "Allow",
117+
"Principal": {
118+
"AWS": "arn:aws:iam::%s:root"
119+
},
120+
"Action": "backup:DeleteBackupVaultAccessPolicy",
121+
"Resource": "*"
122+
}
123+
]
124+
}`, *b.accountID)
123125
// Ignore error from if we can't put permissive backup vault policy in for some reason, that's OK.
124126
_, _ = b.svc.PutBackupVaultAccessPolicy(&backup.PutBackupVaultAccessPolicyInput{
125127
BackupVaultName: &b.backupVaultName,

0 commit comments

Comments
 (0)