-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Backport of s3: fix S3 Object Lock header issue for lock file writes into v1.10 #36146
Backport of s3: fix S3 Object Lock header issue for lock file writes into v1.10 #36146
Conversation
2700ddf
to
4498299
Compare
Because the S3 backend has only diverged from main with the commits to address lockfile header issues with lock enabled buckets, this commit simply copies the existing state of the `internal/backend/remote-state/s3` subfolder onto the `v1.10` branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
% TF_ACC=1 TF_S3_OBJECT_LOCK_TEST=1 go test -count=1 ./...
ok github.com/hashicorp/terraform/internal/backend/remote-state/s3 256.903s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Backport
This PR is auto-generated from #36120 to be assessed for backporting due to the inclusion of the label 1.10-backport.
🚨
The person who merged in the original PR is:
@jar-b
This person should manually cherry-pick the original PR into a new backport PR,
and close this one when the manual backport PR is merged in.
The below text is copied from the body of the original PR.
Fixes #36113
When S3 Object Lock is enabled on a bucket with a retention period, Amazon S3 requires the
Content-MD5
orx-amz-sdk-checksum-algorithm
header to be present in object uploads (PutObject). See Uploading objects to an Object Lock enabled bucket.It seems we overlooked maintaining the default behavior of the
skip_checksum
flag for the lock file when writing to S3 Object Lock-enabled buckets.To clarify the default behavior of
skip_checksum
: by default, if this argument is not set in the backend, we set the S3 checksum algorithm behavior toSHA256
. This causes the underlying S3 AWS SDK V2 serializers to automatically append that requiredx-amz-sdk-checksum-algorithm
header. For more details, see the relevant code in the AWS SDK v2 serializers.This PR updates the lock file implementation to use the same "uploader" that we rely on for writing Terraform state to S3, and preserving the default
skip_checksum
behavior for the lock file. To ensure a consistent and compatible experience with S3 Object Lock-enabled buckets between the two mechanisms writing data to S3.Overview of commits
b667207
4766667
de09b08
701e02c
7b73b16
9db9647
86ca532