Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error due to S3 disabling ACLs by default #76

Open
mvandenburgh opened this issue Jan 17, 2024 · 0 comments
Open

Error due to S3 disabling ACLs by default #76

mvandenburgh opened this issue Jan 17, 2024 · 0 comments

Comments

@mvandenburgh
Copy link

As of April 2023, S3 disables ACLs on new buckets by default - https://aws.amazon.com/about-aws/whats-new/2023/04/amazon-s3-security-best-practices-buckets-default/. This means that a terraform apply on a new project will always fail when attempting to create the aws_s3_bucket_acl resource in the storage module.

Here's the error trace:

Error: creating S3 Bucket (test-app-storage) ACL: operation error S3: PutBucketAcl, https response error StatusCode: 400, RequestID: ..., HostID: ..., api error AccessControlListNotSupported: The bucket does not allow ACLs
with module.django.module.storage.aws_s3_bucket_acl.storage
on .terraform/modules/django/modules/storage/main.tf line 5, in resource "aws_s3_bucket_acl" "storage":
resource "aws_s3_bucket_acl" "storage" {

I'm not sure what the best path forward would be for this Terraform module, but AWS does provide some guidance if one wants to keep ACLs enabled for new buckets - https://docs.aws.amazon.com/AmazonS3/latest/userguide/ensure-object-ownership.html. Terraform code for creating a BucketOwnerPreferred ownership policy can be found in the docs for the s3_bucket_ownership_controls resource - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_ownership_controls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant