Skip to content

Commit

Permalink
Fix 'The bucket does not allow ACLs' error on bucket setup (#568)
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Blankley <31221512+pblankley@users.noreply.github.com>
  • Loading branch information
pblankley committed Jul 8, 2023
1 parent 2ef04cb commit c251aed
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions deploy/terraform/aws/lambda/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,17 @@ resource "aws_s3_bucket" "events" {
}

resource "aws_s3_bucket_acl" "events_acl" {
bucket = aws_s3_bucket.events.id
acl = "private"
depends_on = [aws_s3_bucket_ownership_controls.events_acl_ownership]
}

# Resource to avoid error "AccessControlListNotSupported: The bucket does not allow ACLs"
resource "aws_s3_bucket_ownership_controls" "events_acl_ownership" {
bucket = aws_s3_bucket.events.id
acl = "private"
rule {
object_ownership = "ObjectWriter"
}
}

resource "aws_s3_object" "schemas" {
Expand All @@ -98,8 +107,17 @@ resource "aws_s3_bucket" "buz_schemas" {
}

resource "aws_s3_bucket_acl" "schemas_acl" {
bucket = aws_s3_bucket.buz_schemas.id
acl = "private"
depends_on = [aws_s3_bucket_ownership_controls.schemas_acl_ownership]
}

# Resource to avoid error "AccessControlListNotSupported: The bucket does not allow ACLs"
resource "aws_s3_bucket_ownership_controls" "schemas_acl_ownership" {
bucket = aws_s3_bucket.buz_schemas.id
acl = "private"
rule {
object_ownership = "ObjectWriter"
}
}

resource "aws_ecr_repository" "buz_repository" {
Expand Down

0 comments on commit c251aed

Please sign in to comment.