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

s3 backend cannot write state to buckets with mandatory object lock #23127

Closed
nickatsegment opened this issue Oct 18, 2019 · 2 comments · Fixed by #33940
Closed

s3 backend cannot write state to buckets with mandatory object lock #23127

nickatsegment opened this issue Oct 18, 2019 · 2 comments · Fixed by #33940

Comments

@nickatsegment
Copy link

Terraform Version

Terraform v0.11.11
+ provider.aws v1.60.0
+ provider.external v1.2.0
+ provider.null v2.1.2
+ provider.template v2.1.2

Your version of Terraform is out of date! The latest version
is 0.12.11. You can update by downloading from www.terraform.io/downloads.html

but it looks to be a problem in master as well

Crash Output

Failed to load backend: Error writing state: failed to upload state: InvalidRequest: Content-MD5 HTTP header is required for Put Object requests with Object Lock parameters

Expected Behavior

State should have been written to S3 bucket.

Actual Behavior

Terraform failed to write state to bucket with above error message.

Steps to Reproduce

  1. Create an S3 bucket with object locks enabled, with a default mode of COMPLIANCE (the actual retention period is not important.
  2. Cause terraform to attempt to write to it (apply works)
  3. Get error.

Additional Context

Object lock makes it possible to lock object-versions so that they cannot be deleted; i.e. the specific object-version is retained for some retention period which not even the root user of the AWS account can override.

Ultimately I would have preferred this to have been a backend configuration option, but I was trying to avoid making a feature request :)

References

I couldn't find anything regarding object lock being used with the S3 backend.

The call to PutObject happens around here. As the documents for PutObjectInput state, the ContentMD5 field must be set when using object lock parameters.

@pdecat
Copy link
Contributor

pdecat commented Nov 8, 2021

This seems to be working fine nowadays: #29900

Copy link
Contributor

github-actions bot commented Dec 9, 2023

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 Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants