Skip to content

Commit

Permalink
Add bucket acl for tfsec
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Enright <[email protected]>
  • Loading branch information
jimright committed Sep 25, 2023
1 parent 2320845 commit 8f4c033
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/terraform-cdp-aws-pre-reqs/.tfsec/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
#region TODO: Remove once https://github.com/aquasecurity/tfsec/issues/1799 is fixed
exclude:
- aws-s3-block-public-acls
- aws-s3-block-public-policy
- aws-s3-ignore-public-acls
- aws-s3-no-public-buckets
- aws-s3-specify-public-access-block
#endregion
13 changes: 13 additions & 0 deletions modules/terraform-cdp-aws-pre-reqs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,19 @@ resource "aws_s3_bucket" "cdp_storage_locations" {
force_destroy = true
}

resource "aws_s3_bucket_public_access_block" "cdp_storage_locations" {

for_each = aws_s3_bucket.cdp_storage_locations

bucket = each.value.id

block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true

}

# ------- AWS Buckets directory structures -------
# # Data Storage Objects
# NOTE: Removing creation of the data storage object because CDP overrides this
Expand Down

0 comments on commit 8f4c033

Please sign in to comment.