Skip to content
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

aws_s3_bucket_object metadata key name incorrect #7810

Closed
chanhht opened this issue Mar 5, 2019 · 6 comments
Closed

aws_s3_bucket_object metadata key name incorrect #7810

chanhht opened this issue Mar 5, 2019 · 6 comments
Labels
service/s3 Issues and PRs that pertain to the s3 service.

Comments

@chanhht
Copy link

chanhht commented Mar 5, 2019

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
@ewbankkit
Copy link
Contributor

ewbankkit commented Mar 5, 2019

User-defined metadata keys are stored in lowercase:

@chanhht
Copy link
Author

chanhht commented Mar 6, 2019

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

@ewbankkit
Copy link
Contributor

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

@bflad bflad added waiting-response Maintainers are waiting on response from community or contributor. service/s3 Issues and PRs that pertain to the s3 service. labels Mar 6, 2019
@ewbankkit
Copy link
Contributor

It looks like there is an underlying issue with the AWS SDK: aws/aws-sdk-go#445.
Related:

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Mar 9, 2019
@chanhht
Copy link
Author

chanhht commented Mar 9, 2019

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.

@chanhht chanhht closed this as completed Mar 9, 2019
@ghost
Copy link

ghost commented Mar 31, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

No branches or pull requests

3 participants