us-east-1 S3 buckets created prior to 3/1/2018 can have uppercase letters and underscores, but aws_s3_bucket_acl resource does not allow for them #23676
Labels
bug
Addresses a defect in current functionality.
service/s3
Issues and PRs that pertain to the s3 service.
Milestone
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Expected Behavior
The aws_s3_bucket_acl resource should support all buckets that can currently exist on AWS, including ones with uppercase letters and underscores in their names.
Actual Behavior
aws_s3_bucket_acl throws the error
unexpected format for ID (studioone_logs), expected BUCKET or BUCKET,EXPECTED_BUCKET_OWNER or BUCKET,ACL or BUCKET,EXPECTED_BUCKET_OWNER,ACL
when ACLs connected to buckets with underscores or uppercase letters in their names are applied or imported.Steps to Reproduce
terraform plan
- the plan should show output suggesting that it wants to create the ACL as defined.terraform apply
(or, if the ACL is already defined in the bucket, attempt to runterraform import <resource_path> my_EXAMPLE_bucket
unexpected format for ID (studioone_logs), expected BUCKET or BUCKET,EXPECTED_BUCKET_OWNER or BUCKET,ACL or BUCKET,EXPECTED_BUCKET_OWNER,ACL
Important Factoids
This issue appears to be present because the regex checking the bucket ID input does not allow underscore and uppercase characters to be part of the bucket name. This prevents assigning ACLs to any bucket whose name has these characters, even though the
aws_s3_bucket
resource itself supports these characters in the name.Regex location in provider code:
terraform-provider-aws/internal/service/s3/bucket_acl.go
Line 463 in cf6dd26
AWS documentation regarding the deprecating naming rule (read the Note after the bullet-points):
https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html#:~:text=Note,all%20other%20Regions.
The text was updated successfully, but these errors were encountered: