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

[BUG] Error: updating S3 Bucket Ownership Controls, PutBucketOwnershipControls #20

Open
sblack4 opened this issue Feb 14, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@sblack4
Copy link
Contributor

sblack4 commented Feb 14, 2025

Upgrading from 3.3 to 4.0.1, got:

│ Error: updating S3 Bucket Ownership Controls (1234567890123-us-east-1-s3logging-account): operation error S3: PutBucketOwnershipControls, https response error StatusCode: 400, RequestID: DJQM9JMTK5EESYQ6, HostID: bLgjmqTYeXc2Ry4dmpy+/dXLxHtqzqsR/Ojz3tozAgEVEKHH5kpOpqM9yyVdUPk+FEQVXa4IHMk=, api error InvalidBucketAclWithObjectOwnership: Bucket cannot have ACLs set with ObjectOwnership's BucketOwnerEnforced setting
│ 
│   with module.s3logging-bucket.aws_s3_bucket_ownership_controls.this,
│   on .terraform/modules/s3logging-bucket/main.tf line 82, in resource "aws_s3_bucket_ownership_controls" "this":
│   82: resource "aws_s3_bucket_ownership_controls" "this" {

My solution was to go in and disable the individual ACLs manually, then I was able to (also manually) disable ACLs and set

      ~ rule {
          ~ object_ownership = "BucketOwnerPreferred" -> "BucketOwnerEnforced"
        }

I think it's related to this note in https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_acl

terraform destroy does not delete the S3 Bucket ACL but does remove the resource from Terraform state.

@sblack4 sblack4 added the bug Something isn't working label Feb 14, 2025
@sblack4 sblack4 self-assigned this Feb 14, 2025
@sblack4
Copy link
Contributor Author

sblack4 commented Feb 14, 2025

Not sure there is a good IAC solution to this. Seems to be a limit of the TF resource

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant