-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Notice: S3 - Changes to Defaults (Block Public Access and ACL's) #28353
Notice: S3 - Changes to Defaults (Block Public Access and ACL's) #28353
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
It would be very useful for an acl object that sets the acl to private to noop and succeed rather than fail when ownership controls are BucketOwnerEnforced. We are now having to optionally count-off the acl resource if ownership_controls == "BucketOwnerEnforced" |
AWS recently made changes to how S3 buckets are created. More information can be found here: hashicorp/terraform-provider-aws#28353
AWS recently made changes to how S3 buckets are created. More information can be found here: hashicorp/terraform-provider-aws#28353
They are not supported anymore on new buckets. As far as I know, we're the only consumer of this module, so just using the defaults (which is same as "private" in old canned ACLs) should be good enough. URL: hashicorp/terraform-provider-aws#28353
Hello, I'm trying to deploy S3 with ownership and private ACL (the last alternative suggestion): resource "aws_s3_bucket" "state" {
bucket = "${var.name_prefix}-terraform-state"
}
resource "aws_s3_bucket_ownership_controls" "state" {
bucket = aws_s3_bucket.state.id
rule {
object_ownership = "BucketOwnerEnforced"
}
}
resource "aws_s3_bucket_acl" "state" {
depends_on = [
aws_s3_bucket_ownership_controls.state,
]
bucket = aws_s3_bucket.state.id
acl = "private"
} However, the Removing EDIT: I had the wrong ownership configuration. It should be |
Hi, @mattiasnixell - I hit this error today with nearly identical code. We have a module that creates S3 buckets in accordance with company policy. It defines the aws_s3_bucket_ownership_controls and the private aws_s3_bucket_acl (although we did not have the The behavior I saw was that the first run of the pipeline would fail with the AccessControlListNotSupported error. I was able to just plan and apply again, and the ACL applied cleanly. Presumably that is because the bucket ownership controls were applied in the first apply. I should mention that the behavior was intermittent, suggesting a possible race condition. This would suggest that the I do notice that your example uses |
This resolves an issue related to the April 2023 S3 API changes. More info can be found here: hashicorp/terraform-provider-aws#28353
This resolves an issue related to the April 2023 S3 API changes. More info can be found here: hashicorp/terraform-provider-aws#28353 Closes #28353
I'm trying to follow the examples here: Which indicate that an ACL set to edit: To clarify my confusion is why delivering access logs from within the same account would require me to allow public ACL's. |
- create ownership controls - explicitly set the access to private See hashicorp/terraform-provider-aws#28353
Since we coded our S3 buckets in terraform, AWS has made some changes to S3 ACLs. The way old way we had S3 ACLs configured caused errors when creating a new environment. The full summary of this change is available by Hashicorp on github: hashicorp/terraform-provider-aws#28353 Here is a summary from Hashicorp: "The impending S3 security changes will not require breaking changes to v3 or v4 of the Terraform AWS provider. However, some previously valid S3 bucket ACL configurations will begin returning errors for net-new buckets. Existing buckets (and their corresponding terraform configuration) are not impacted." Jira: https://technologyprogramme.atlassian.net/jira/software/projects/GW/boards/251?assignee=5e45277d29e6d00c970616c6&selectedIssue=GW-1471
Since we coded our S3 buckets in terraform, AWS has made some changes to S3 ACLs. The way old way we had S3 ACLs configured caused errors when creating a new environment. The full summary of this change is available by Hashicorp on github: hashicorp/terraform-provider-aws#28353 Here is a summary from Hashicorp: "The impending S3 security changes will not require breaking changes to v3 or v4 of the Terraform AWS provider. However, some previously valid S3 bucket ACL configurations will begin returning errors for net-new buckets. Existing buckets (and their corresponding terraform configuration) are not impacted." Jira: https://technologyprogramme.atlassian.net/jira/software/projects/GW/boards/251?assignee=5e45277d29e6d00c970616c6&selectedIssue=GW-1471
Warning This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them. Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Announcement
Blog post
FAQ
Relevant resources:
aws_s3_bucket
aws_s3_bucket_acl
aws_s3_bucket_ownership_controls
aws_s3_bucket_public_access_block
Relates #22069
Relates #6607
Terraform AWS Provider Impact
This section will detail the impact of the upcoming AWS S3 security changes on the Terraform AWS Provider.
Summary
The impending S3 security changes will not require breaking changes to v3 or v4 of the Terraform AWS provider. However, some previously valid S3 bucket ACL configurations will begin returning errors for net-new buckets. Existing buckets (and their corresponding terraform configuration) are not impacted.
ACL Changes
ACLs can be defined either directly on the
aws_s3_bucket
resource, or via the standaloneaws_s3_bucket_acl
resource. This is true in both v3 and v4 or the provider, though theacl
attribute on the S3 bucket resource was officially deprecated in v4.Inline:
Standalone Resource:
While existing buckets are not impacted by the impending security changes, the following configuration patterns are impacted for net-new buckets:
acl
where the value is notprivate
.aws_s3_bucket_acl
resource with default security settings.Inline
acl
where the value is notprivate
In both v3 and v4 of the provider, the inline
acl
attribute defaults to private when unset. Passing a value ofprivate
on bucket creation continues to work post-security changes, but any other value requires the default object ownership settings be changed in the same request. Currently, there is no way to do this via theaws_s3_bucket
resource. Adoption of the standaloneaws_s3_bucket_acl
resource, paired with theaws_s3_bucket_public_access_block
andaws_s3_bucket_ownership_controls
resources allows the default security settings to be adjusted as necessary.Existing Configuration
Error
Alternative Configuration
This configuration splits bucket and ACL creation into separate API calls, with the requisite block public access and object ownership API calls in between.
Standalone
aws_s3_bucket_acl
resource with default security settingsWith the default security settings unchanged, any attempt to set an ACL on an existing bucket via the standalone ACL resource will fail, even if the value is
private
.Existing Configuration
Error
Alternative Configuration
With the new default security settings, a private ACL definition can likely be removed completely as the default security settings already ensure public access is restricted upon bucket creation.
However, if a private ACL is explicitly required, the following configuration splits bucket and ACL creation into separate API calls, with the requisite object ownership API call in between.
For use cases requiring non-
private
ACLs, an additionalaws_s3_bucket_public_access_block
resource would also be required, as documented in the inline use case above.The text was updated successfully, but these errors were encountered: