Skip to content

Commit

Permalink
Use the new public access block with ownership controls
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmendez committed May 27, 2023
1 parent 379b43c commit f5fbe45
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion terraform/development/spa/create/bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,29 @@ resource "aws_s3_bucket" "bucketdev" {
}
}

resource "aws_s3_bucket_ownership_controls" "bucketdev" {
bucket = aws_s3_bucket.bucketdev.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}

resource "aws_s3_bucket_public_access_block" "bucketdev" {
bucket = aws_s3_bucket.bucketdev.id

block_public_acls = false
block_public_policy = false
ignore_public_acls = false
restrict_public_buckets = false
}

resource "aws_s3_bucket_acl" "bucketdev" {
bucket = var.aws_bucket_name
depends_on = [
aws_s3_bucket_ownership_controls.bucketdev,
aws_s3_bucket_public_access_block.bucketdev,
]

bucket = aws_s3_bucket.bucketdev.id
acl = "public-read"
}

Expand Down

0 comments on commit f5fbe45

Please sign in to comment.