Skip to content

Commit 8aa14db

Browse files
committed
Fix: Alarm api_unauthorized for HeadBucket from AWS Config (#6134, PR #6842)
2 parents b35d598 + 7b9ac10 commit 8aa14db

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

terraform/shared/shared.tf.json.template.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,12 @@ def conformance_pack(name: str) -> str:
250250
'Service': 'config.amazonaws.com'
251251
},
252252
'Action': ['s3:GetBucketAcl', 's3:ListBucket'],
253-
'Resource': '${aws_s3_bucket.aws_config.arn}'
253+
'Resource': '${aws_s3_bucket.aws_config.arn}',
254+
'Condition': {
255+
'StringEquals': {
256+
'AWS:SourceAccount': config.aws_account_id
257+
}
258+
}
254259
},
255260
{
256261
'Effect': 'Allow',
@@ -262,7 +267,8 @@ def conformance_pack(name: str) -> str:
262267
f'/*/AWSLogs/{config.aws_account_id}/Config/*',
263268
'Condition': {
264269
'StringEquals': {
265-
's3:x-amz-acl': 'bucket-owner-full-control'
270+
's3:x-amz-acl': 'bucket-owner-full-control',
271+
'AWS:SourceAccount': config.aws_account_id
266272
}
267273
}
268274
}

0 commit comments

Comments
 (0)