Terraform-provider-aws: `aws_s3_bucket_object` metadata key name incorrect

Created on 5 Mar 2019  ยท  6Comments  ยท  Source: hashicorp/terraform-provider-aws

Terraform Version

Terraform v0.11.11

  • provider.aws v2.0.0
  • provider.null v2.1.0

Affected Resource(s)

  • aws_s3_bucket_object

Terraform Configuration Files

provider "aws" {
  region = "ap-southeast-1"
}

data "aws_s3_bucket_object" "test" {
  bucket = "test-terraform-s3-bucket-object"
  key = "test"
}

resource "null_resource" "test" {
  provisioner "local-exec" {
    command = "aws s3api head-object --bucket 'test-terraform-s3-bucket-object' --key 'test' --query 'Metadata'"
  }
}

output "metadata" {
  value = "${data.aws_s3_bucket_object.test.metadata}"
}

Expected Behavior

The output of data.aws_s3_bucket_object.test.metadata key name should be the same as aws cli and aws S3 console (e.g. test )

metadata = {
  test = Test Bucket Object 
}

Actual Behavior

The key name automatic capitalize the first letter (e.g. Test instead of test )

metadata = {
  Test = Test Bucket Object
}

Steps to Reproduce

  1. terraform apply
servics3

All 6 comments

User-defined metadata keys are stored in lowercase:

Thank @ewbankkit for the doc, then clearly the Metadata keys returned should be in lowercase.

Yes, I'll try and dig in to this when I get time.

Thanks, I think the issue has been noticed before and PR is ready. In the meanwhile, since the metadata key always is lowercase, I do a workaround by casting to lowercase.

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.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

Was this page helpful?
0 / 5 - 0 ratings