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

[Bug]: PutBucketTagging causes API error when creating new S3 bucket #33717

Closed
slackfan opened this issue Oct 2, 2023 · 3 comments · Fixed by #35710
Closed

[Bug]: PutBucketTagging causes API error when creating new S3 bucket #33717

slackfan opened this issue Oct 2, 2023 · 3 comments · Fixed by #35710
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@slackfan
Copy link

slackfan commented Oct 2, 2023

Terraform Core Version

1.5.7

AWS Provider Version

5.19.0

Affected Resource(s)

aws_s3_bucket

Expected Behavior

When creating a new S3 bucket, the provider shall handle issues with eventual consistency in regards to the PutBucketTagging API method.

Actual Behavior

When creating a new S3 bucket, the provider assumes that the PutBucketTagging API method is aware of the previously created bucket.

Relevant Error/Panic Output Snippet

Error: reading Amazon S3 (Simple Storage) Bucket (bucketnameforgithubissue): couldn't find resource

  with module.bucketnameforgithubissue.aws_s3_bucket.s3_bucket,
  on modules/s3_bucket/main.tf line 1, in resource "aws_s3_bucket" "s3_bucket":
   1: resource "aws_s3_bucket" "s3_bucket" {

Terraform Configuration Files

resource "aws_s3_bucket" "s3_bucket" {
  bucket        = var.bucket_name
  force_destroy = var.force_destroy
  tags          = var.tags
}

Steps to Reproduce

The issue is not reliably reproducible.

Debug Output

2023-10-02T07:13:44.909Z [DEBUG] provider.terraform-provider-aws_v5.19.0_x5: HTTP Response Received: http.response.header.x_amz_id_2=p+PVcIzeAzLIrbe1V1rzYs3yGnOW6Ml72bThqvfO9swutoen1432agPMKRZGnBsfMW11Vy9OFtk= http.response.header.x_amz_request_id=ED3JYA3J5ATMDSV3 rpc.system=aws-api rpc.method=CreateBucket rpc.service=S3 tf_mux_provider=*schema.GRPCProviderServer http.duration=196 http.response.header.server=AmazonS3 http.status_code=200 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ApplyResourceChange http.response.header.date="Mon, 02 Oct 2023 07:15:40 GMT" http.response.header.location=/bucketnameforgithubissue tf_resource_type=aws_s3_bucket @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.37/logger.go:157 @module=aws aws.region=us-east-1 http.response.body= tf_aws.sdk=aws-sdk-go tf_req_id=1c145e19-4db4-6557-13e0-022f0b3f8c68 timestamp=2023-10-02T07:13:44.909Z
2023-10-02T07:13:44.923Z [DEBUG] provider.terraform-provider-aws_v5.19.0_x5: HTTP Request Sent: net.peer.name=s3.amazonaws.com tf_aws.sdk=aws-sdk-go tf_provider_addr=registry.terraform.io/hashicorp/aws aws.region=us-east-1 http.flavor=1.1 http.request.body= http.url=https://s3.amazonaws.com/bucketnameforgithubissue?tagging= http.method=GET http.request.header.x_amz_date=20231002T071344Z rpc.method=GetBucketTagging tf_mux_provider=*schema.GRPCProviderServer tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.37/logger.go:109 @module=aws http.request.header.x_amz_content_sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 rpc.service=S3 rpc.system=aws-api tf_req_id=1c145e19-4db4-6557-13e0-022f0b3f8c68 tf_resource_type=aws_s3_bucket http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************MAVF/20231002/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=*****" http.request.header.x_amz_security_token=***** http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.5.7 (+https://www.terraform.io) terraform-provider-aws/5.19.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.45.18 (go1.20.7; linux; amd64)" timestamp=2023-10-02T07:13:44.923Z
<Error><Code>NoSuchTagSet</Code><Message>The TagSet does not exist</Message><BucketName>bucketnameforgithubissue</BucketName><RequestId>Y5JWD23DVBS4HHNE</RequestId><HostId>ltNTwBgoP6eH5N/RwteDwWDwteAdgko3F4+ct5Dd8xLqXms3Cv1wX7oL+KepGrerWhGYe3oX8r4=</HostId></Error>
2023-10-02T07:13:44.936Z [DEBUG] provider.terraform-provider-aws_v5.19.0_x5: HTTP Request Sent: http.request.header.x_amz_date=20231002T071344Z rpc.method=PutBucketTagging rpc.service=S3 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ApplyResourceChange aws.region=us-east-1 http.method=PUT http.request_content_length=1458 rpc.system=aws-api tf_aws.sdk=aws-sdk-go @module=aws http.request.header.x_amz_security_token=***** tf_resource_type=aws_s3_bucket http.request.body="<Tagging xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><TagSet><Tag><Key>Function</Key><Value>blablub</Value></TagSet></Tagging>
[truncated...]" http.flavor=1.1 http.request.header.x_amz_content_sha256=d2bd3d2473e8dfec073e8662e80b16154031e8df52b5519f1de9f32b1d0d0488 http.url=https://s3.amazonaws.com/bucketnameforgithubissue?tagging= http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.5.7 (+https://www.terraform.io) terraform-provider-aws/5.19.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.45.18 (go1.20.7; linux; amd64)" tf_mux_provider=*schema.GRPCProviderServer tf_req_id=1c145e19-4db4-6557-13e0-022f0b3f8c68 @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.37/logger.go:109 http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************MAVF/20231002/us-east-1/s3/aws4_request, SignedHeaders=content-length;content-md5;host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=*****" http.request.header.content_md5=NdmsWI2cfQcNDNxcoAA//Q== net.peer.name=s3.amazonaws.com timestamp=2023-10-02T07:13:44.936Z
2023-10-02T07:13:45.093Z [ERROR] provider.terraform-provider-aws_v5.19.0_x5: Response contains error diagnostic: diagnostic_summary="reading Amazon S3 (Simple Storage) Bucket (bucketnameforgithubissue): couldn't find resource" tf_proto_version=5.4 @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_detail= tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=1c145e19-4db4-6557-13e0-022f0b3f8c68 tf_rpc=ApplyResourceChange diagnostic_severity=ERROR tf_resource_type=aws_s3_bucket timestamp=2023-10-02T07:13:45.093Z

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@slackfan slackfan added the bug Addresses a defect in current functionality. label Oct 2, 2023
@github-actions
Copy link

github-actions bot commented Oct 2, 2023

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/s3 Issues and PRs that pertain to the s3 service. label Oct 2, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 2, 2023
@slackfan slackfan changed the title [Bug]: [Bug]: PutBucketTagging causes API error when creating new S3 bucket Oct 2, 2023
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Oct 26, 2023
@github-actions github-actions bot added this to the v5.40.0 milestone Mar 4, 2024
Copy link

github-actions bot commented Mar 7, 2024

This functionality has been released in v5.40.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!

Copy link

github-actions bot commented Apr 7, 2024

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 Apr 7, 2024
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. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants