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

Missing information in documentation about name in aws_s3_bucket_metric #25251

Closed
ByJacob opened this issue Jun 9, 2022 · 4 comments · Fixed by #25260
Closed

Missing information in documentation about name in aws_s3_bucket_metric #25251

ByJacob opened this issue Jun 9, 2022 · 4 comments · Fixed by #25260
Labels
bug Addresses a defect in current functionality. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@ByJacob
Copy link

ByJacob commented Jun 9, 2022

In resource aws_s3_bucket_metric can use name with max 64 characters. After it return error:

Error: error putting S3 Bucket Metrics Configuration: MalformedXML: The XML you provided was not well-formed or did not validate against our published schema

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Affected Resource(s)

  • aws_s3_bucket_metric

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp
resource "aws_s3_bucket" "example" {
  bucket = "example"
}

resource "aws_s3_bucket_metric" "example-entire-bucket" {
  bucket = aws_s3_bucket.example.bucket
  name   = "VeryLongNameAfter64Characters-abcdefghijklmnopqrstuwyz-abcdefghijklmnopqrstuwyz"
}

Debug Output

╷
│ Error: error putting S3 Bucket Metrics Configuration: MalformedXML: The XML you provided was not well-formed or did not validate against our published schema
│ 	status code: 400, request id: C4FDAJP6S0BQ493N, host id: avzLCUyU5bjR/ljknCRolXqry+iXOZGXJudNXdhi6lh99B6Z1HHkZ0NKoVmOralXhltceUWRCkA=
│ 
│   with aws_s3_bucket_metric.client_backup_metric["xyz"],
│   on main.tf line 432, in resource "aws_s3_bucket_metric" "xyz_backup_metric":
│  432: resource "aws_s3_bucket_metric" "client_backup_metric" {
│ 
╵

Expected Behavior

It will return a clearer error

Actual Behavior

MalformedXML error.

Steps to Reproduce

  1. terraform apply

Important Factoids

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/s3 Issues and PRs that pertain to the s3 service. labels Jun 9, 2022
@justinretzolk
Copy link
Member

Hey @ByJacob 👋 Thank you very much for taking the time to raise this! I was able to confirm this behavior (reproduction notes below). While I think that updating the documentation is needed, I think there's a bit more to be done here as well -- namely; we should make a change to the provider to validate the name is <= 64 characters. For that reason, I'm going to hold off on updating the docs so that we can do both at once.

For whoever picks this up, my reproduction proving this behavior:

Working

Configuration:

resource "aws_s3_bucket" "test" {
  bucket = "jretzolk-test"
}

resource "random_string" "test" {
  length  = 64
  special = false
}

resource "aws_s3_bucket_metric" "test" {
  bucket = aws_s3_bucket.test.bucket
  name   = random_string.test.result
}

Output:

Plan: 3 to add, 0 to change, 0 to destroy.
random_string.test: Creating...
random_string.test: Creation complete after 0s [id=KkG9ogxU3duvIhKxIB1fG1WlVkCOqnncU7PjoVTreEzVdlB7oMb99LNDyfgOkmpf]
aws_s3_bucket.test: Creating...
aws_s3_bucket.test: Creation complete after 2s [id=jretzolk-test]
aws_s3_bucket_metric.test: Creating...
aws_s3_bucket_metric.test: Creation complete after 0s [id=jretzolk-test:KkG9ogxU3duvIhKxIB1fG1WlVkCOqnncU7PjoVTreEzVdlB7oMb99LNDyfgOkmpf]

Apply complete! Resources: 3 added, 0 changed, 0 destroyed.

Not working

Configuration:

resource "aws_s3_bucket" "test" {
  bucket = "jretzolk-test"
}

resource "random_string" "test" {
  length  = 65
  special = false
}

resource "aws_s3_bucket_metric" "test" {
  bucket = aws_s3_bucket.test.bucket
  name   = random_string.test.result
}

Output:

Plan: 3 to add, 0 to change, 0 to destroy.
random_string.test: Creating...
random_string.test: Creation complete after 0s [id=Zs0CBxX27kVb2HNgF2hI5wjLrFi8ioUwiEWuDF7JUrZeSgKZPfxkBzqainal7Pkae]
aws_s3_bucket.test: Creating...
aws_s3_bucket.test: Creation complete after 1s [id=jretzolk-test]
aws_s3_bucket_metric.test: Creating...
╷
│ Error: error putting S3 Bucket Metrics Configuration: MalformedXML: The XML you provided was not well-formed or did not validate against our published schema
│       status code: 400, request id: DH90RA2ZAARJ609B, host id: PL/ee2FJ8tUhy+020Wty95uyStjltfb3K5gnLuNBq/VGGbLs/DKSp7eNc8mR0krLYN8WzjbD5nk=
│
│   with aws_s3_bucket_metric.test,
│   on main.tf line 10, in resource "aws_s3_bucket_metric" "test":
│   10: resource "aws_s3_bucket_metric" "test" {
│
╵

@justinretzolk justinretzolk added bug Addresses a defect in current functionality. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. and removed needs-triage Waiting for first response or review from a maintainer. labels Jun 9, 2022
@meetreks
Copy link
Contributor

I am looking at this issue.

@github-actions
Copy link

This functionality has been released in v4.20.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants