From 4e8b4cc0b987e6f6f8f70a5f97c2483bb29fa297 Mon Sep 17 00:00:00 2001 From: Ben Sewell Date: Thu, 23 Nov 2023 08:52:52 +0000 Subject: [PATCH 1/2] #384: Fix ACL deployment failure. --- modules/statics-deploy/main.tf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/statics-deploy/main.tf b/modules/statics-deploy/main.tf index a9171ba1..db452034 100644 --- a/modules/statics-deploy/main.tf +++ b/modules/statics-deploy/main.tf @@ -14,7 +14,16 @@ resource "aws_s3_bucket" "static_upload" { tags = merge(var.tags, var.tags_s3_bucket) } +resource "aws_s3_bucket_ownership_controls" "static_upload" { + bucket = aws_s3_bucket.static_upload.id + rule { + object_ownership = "BucketOwnerPreferred" + + } +} + resource "aws_s3_bucket_acl" "static_upload" { + depends_on = [aws_s3_bucket_ownership_controls.static_upload] bucket = aws_s3_bucket.static_upload.id acl = "private" } @@ -39,7 +48,15 @@ resource "aws_s3_bucket" "static_deploy" { tags = merge(var.tags, var.tags_s3_bucket) } +resource "aws_s3_bucket_ownership_controls" "static_deploy" { + bucket = aws_s3_bucket.static_deploy.id + rule { + object_ownership = "BucketOwnerPreferred" + } +} + resource "aws_s3_bucket_acl" "static_deploy" { + depends_on = [aws_s3_bucket_ownership_controls.static_deploy] bucket = aws_s3_bucket.static_deploy.id acl = "private" } From 1eeccbf3637bf9121c16821c49ae89d65763a3d4 Mon Sep 17 00:00:00 2001 From: Ben Sewell Date: Thu, 23 Nov 2023 08:55:13 +0000 Subject: [PATCH 2/2] Terraform format --- modules/statics-deploy/main.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/statics-deploy/main.tf b/modules/statics-deploy/main.tf index db452034..1c492db9 100644 --- a/modules/statics-deploy/main.tf +++ b/modules/statics-deploy/main.tf @@ -18,14 +18,14 @@ resource "aws_s3_bucket_ownership_controls" "static_upload" { bucket = aws_s3_bucket.static_upload.id rule { object_ownership = "BucketOwnerPreferred" - + } } resource "aws_s3_bucket_acl" "static_upload" { depends_on = [aws_s3_bucket_ownership_controls.static_upload] - bucket = aws_s3_bucket.static_upload.id - acl = "private" + bucket = aws_s3_bucket.static_upload.id + acl = "private" } resource "aws_s3_bucket_notification" "on_create" { @@ -57,8 +57,8 @@ resource "aws_s3_bucket_ownership_controls" "static_deploy" { resource "aws_s3_bucket_acl" "static_deploy" { depends_on = [aws_s3_bucket_ownership_controls.static_deploy] - bucket = aws_s3_bucket.static_deploy.id - acl = "private" + bucket = aws_s3_bucket.static_deploy.id + acl = "private" } # CloudFront permissions for the bucket