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

Support PutBucketReplication x-amz-bucket-object-lock-token #14061

Closed
prettymuchbryce opened this issue Jul 6, 2020 · 9 comments · Fixed by #23624
Closed

Support PutBucketReplication x-amz-bucket-object-lock-token #14061

prettymuchbryce opened this issue Jul 6, 2020 · 9 comments · Fixed by #23624
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@prettymuchbryce
Copy link

prettymuchbryce commented Jul 6, 2020

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

Description

AWS S3 allows for creating both a replication_configuration as well as an object_lock_configuration. However, if used together, then AWS support must be contacted and a token (x-amz-bucket-object-lock-token) supplied to enable the combination of both replication and object locking for an S3 bucket.

After contacting AWS support, the AWS support team instructs you run a command like this with a <TOKEN> that they supply.

aws s3api put-bucket-replication --bucket <BUCKET_NAME> --replication-configuration <REPLICATION CONFIGURATION> --token <TOKEN>

This <TOKEN> is mapped to the x-amz-bucket-object-lock-token header in the request to PutBucketReplication.

Currently there is no way to manage this configuration through Terraform.

New or Affected Resource(s)

  • aws_s3_bucket

References

@prettymuchbryce prettymuchbryce added the enhancement Requests to existing resources that expand the functionality or scope. label Jul 6, 2020
@ghost ghost added the service/s3 Issues and PRs that pertain to the s3 service. label Jul 6, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jul 6, 2020
@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Jul 6, 2020
@ewbankkit
Copy link
Contributor

@prettymuchbryce Thanks for raising this issue.
Is the token value something that you would expect to set in the Terraform configuration and hence be persisted in state?

@prettymuchbryce
Copy link
Author

Hi @ewbankkit. Yes. That is my expectation given my understanding of this token.

@ebarault
Copy link

ebarault commented Mar 1, 2021

hi @ewbankkit I'm facing the exact same issue.
The current aws_s3_bucket module raises the following error when trying to add replication configurations on object-lock enabled buckets:

"Error putting S3 replication configuration: InvalidRequest: Replication configuration cannot be applied to an Object Lock enabled bucket"

Indeed, after contacting the AWS support team, they provided us with a token that needs to be passed as described by @prettymuchbryce

@prettymuchbryce did you bypass the problem by making your own api calls to the aws s3 api ?

@ebarault
Copy link

@ewbankkit Hi, is there any plan to tackle this issue at short term? any PR in progress i could review/test ?

@ahmazza
Copy link

ahmazza commented Mar 28, 2021

Hi, any update on this? It's really needed

@lnader
Copy link

lnader commented Jun 22, 2021

👍

@akloss-cibo
Copy link

FWIW, I've observed that as long as the configuration applied by aws_s3_bucket_replication_configuration exactly matches what already exists, the API will succeed even without the token. It's clunky, but using something like a null_resource to use the aws cli to create the replication configuration with a token and using aws_s3_bucket_replication_configuration does mostly work.

@github-actions
Copy link

This functionality has been released in v4.5.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

github-actions bot commented May 9, 2022

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 May 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
7 participants