-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Description
Terraform and AWS Provider Version
Terraform v1.14.1
Terraform AWS Provider 6.25.0Affected Resource(s) or Data Source(s)
aws_s3_bucket with tags
Expected Behavior
The CreateBucket action including tags should not attempt when the destination region does not support the "Tags" parameter within the "CreateBucketConfiguration" option.
Actual Behavior
The AWS S3API returns an error for 'unsupported argument' due to the region not supported bucket configuration including tags, causing the terraform deployment to fail.
Relevant Error/Panic Output
Error: creating S3 Bucket ({bucket-name}): operation error S3: CreateBucket, https response error StatusCode: 400, RequestID: {request-id}, HostID: {host-id}, api error UnsupportedArgument: The request contained an unsupported argument.
Sample Terraform Configuration
Click to expand configuration
resource "aws_s3_bucket" "my_bucket_with_tags" {
bucket = "my-bucket-with-tags"
tags = {
Name = "my tagged bucket"
}
}Steps to Reproduce
introduced in commit #07f46ca
- create basic bucket that includes tags
- attempt to deploy to a region that does not support Tags within the CreateBucketConfiguration.
- see error
alternative:
directly using the AWS CLI to show the error:
aws s3api create-bucket --bucket my-bucket-with-tags --create-bucket-configuration 'LocationConstraint={region-without-support},Tags=[{Key=Name,Value=my-tagged-bucket}]'
Debug Logging
No response
GenAI / LLM Assisted Development
n/a
Important Facts and References
introduced in commit #07f46ca
Confirmed via AWS support case that this limitation is region-specific, and thus the terraform provider should validate the region's capabilities and fail back to "create-then-put" sequence if it doesn't.
Would you like to implement a fix?
No