Skip to content

Commit

Permalink
Adding ownership controls to the webite bucket (#60)
Browse files Browse the repository at this point in the history
* setting the ownership controls for the website bucket to "BucketOwnerPreferred" so ACLs can be created on the bucket

* Fix for terraform fmt
  • Loading branch information
josmo authored Jun 6, 2023
1 parent 6196227 commit 76cb862
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion website.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,19 @@ resource "aws_s3_bucket_logging" "website" {
target_prefix = "website/"
}

resource "aws_s3_bucket_acl" "website" {
resource "aws_s3_bucket_ownership_controls" "website" {
provider = aws.main

bucket = aws_s3_bucket.website.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}

resource "aws_s3_bucket_acl" "website" {
depends_on = [aws_s3_bucket_ownership_controls.website]
provider = aws.main

bucket = aws_s3_bucket.website.id
acl = var.website_bucket_acl
}
Expand Down

0 comments on commit 76cb862

Please sign in to comment.