Skip to content

S3 Tag-on-Create does not validate region support #45566

@berky2755

Description

@berky2755

Terraform and AWS Provider Version

Terraform v1.14.1
Terraform AWS Provider 6.25.0

Affected 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

  1. create basic bucket that includes tags
  2. attempt to deploy to a region that does not support Tags within the CreateBucketConfiguration.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAddresses a defect in current functionality.needs-triageWaiting for first response or review from a maintainer.service/s3Issues and PRs that pertain to the s3 service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions