Skip to content

Commit 23f3017

Browse files
authored
Fix incorrect parameter in Log Archive Read Only custom resource (#596)
Authored-by: Brian Fanning <bfannin@amazon.com>
1 parent 2679c11 commit 23f3017

File tree

1 file changed

+2
-4
lines changed
  • src/lib/custom-resources/cdk-s3-update-logarchive-bucket-policy/runtime/src

1 file changed

+2
-4
lines changed

src/lib/custom-resources/cdk-s3-update-logarchive-bucket-policy/runtime/src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,12 @@ async function onDelete(event: CloudFormationCustomResourceDeleteEvent) {
200200
let keyPolicy = await getKmsKeyPolicy(props.logBucketKmsKeyArn);
201201

202202
if (Object.keys(bucketPolicy).length > 0) {
203-
const updatedStatements = removeExistingReadOnlyStatement(bucketPolicy.Statement);
204-
bucketPolicy.Statement = updatedStatements;
203+
bucketPolicy = removeExistingReadOnlyStatement(bucketPolicy);
205204
const response = await putBucketPolicy(props.logBucketName, JSON.stringify(bucketPolicy));
206205
}
207206

208207
if (Object.keys(keyPolicy).length > 0) {
209-
const updatedStatements = removeExistingReadOnlyStatement(keyPolicy.Statement);
210-
keyPolicy.Statement = updatedStatements;
208+
keyPolicy = removeExistingReadOnlyStatement(keyPolicy);
211209
const response = await putKmsKeyPolicy(props.logBucketKmsKeyArn, JSON.stringify(keyPolicy));
212210
}
213211
return {};

0 commit comments

Comments
 (0)