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]: Unable to destroy s3_object in a versioned bucket in 5.6.x #32312

Closed
andyprinceuk opened this issue Jun 30, 2023 · 4 comments
Closed

[Bug]: Unable to destroy s3_object in a versioned bucket in 5.6.x #32312

andyprinceuk opened this issue Jun 30, 2023 · 4 comments
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.

Comments

@andyprinceuk
Copy link

Terraform Core Version

1.3.9

AWS Provider Version

5.6.0,5.6.1

Affected Resource(s)

aws_s3_object

Expected Behavior

Running destroy for an aws_s3_object in a versioned bucket should delete the object

Actual Behavior

Destroy fails

Relevant Error/Panic Output Snippet

╷
│ Error: deleting S3 Bucket (ap-test-bucket-uw2) Object (some-key.json): InvalidArgument: Invalid attribute name specified.
│       status code: 400, request id: ..., host id: ...
│ 
│

Terraform Configuration Files

provider "aws" {
  region = "us-west-2"
}

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "5.6.1"
    }
  }
}

resource "aws_s3_bucket" "example" {
  bucket = "ap-test-bucket-uw2"
}

resource "aws_s3_bucket_versioning" "example" {
  bucket = aws_s3_bucket.example.id

  versioning_configuration {
    status = "Enabled"
    # status = "Suspended"
  }
}

resource "aws_s3_object" "example" {
  bucket   = aws_s3_bucket.example.id
  content  = jsonencode({
    some = "data"
  })
  key      = "some-key.json"

  depends_on = [ aws_s3_bucket_versioning.example ]
}

Steps to Reproduce

terraform apply
terraform destroy

Debug Output

No response

Panic Output

No response

Important Factoids

One difference observed between 5.5.0 and 5.6.0 in the DELETE API call is in the authorization header indicating an additional header:
5.5.0:

http.request.header.authorization="AWS4-HMAC-SHA256 Credential=AKIA************VOIA********0/us-west-2/s3/aws4_request, Sign**********host;x-amz-content-sha256;x-amz-date, Signature=*****"

5.6.0:

http.request.header.authorization="AWS4-HMAC-SHA256 Credential=AKIA************VOIA********0/us-west-2/s3/aws4_request, Sign**********host;x-amz-content-sha256;x-amz-date;x-amz-optional-object-attributes, Signature=*****"

with that header being empty:

... http.request.body= http.request.header.x_amz_optional_object_attributes= net.peer.name=...

Furthermore, this also reproduces if the bucket versioning is set to "Suspended" as well as "Enabled"

References

No response

Would you like to implement a fix?

No

@andyprinceuk andyprinceuk added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Jun 30, 2023
@github-actions
Copy link

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 Jun 30, 2023
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Jun 30, 2023
@ewbankkit
Copy link
Contributor

@andyprinceuk Thanks for raising this issue.
It has already been noticed in #32307. I'm going to close this one as a duplicate so that we can concentrate discussion in the linked issue.
Please add any additional comments there.

@andyprinceuk
Copy link
Author

Thanks @ewbankkit

@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 31, 2023
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

No branches or pull requests

2 participants