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

aws_secretsmanager_secret does not rebuild deleted secret #10259

Closed
richardgavel opened this issue Sep 27, 2019 · 2 comments
Closed

aws_secretsmanager_secret does not rebuild deleted secret #10259

richardgavel opened this issue Sep 27, 2019 · 2 comments
Labels
service/secretsmanager Issues and PRs that pertain to the secretsmanager service.

Comments

@richardgavel
Copy link

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 "me too" comments, 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

Terraform Version

0.11.8

AWS provider version 1.60.0

Affected Resource(s)

  • aws_secrets_manager_secret

Expected Behavior

Deleting a secret and recreating it right away should succeed as long as the recover_window_in_days was set to 0 on the create.

Actual Behavior

Error message: An error occurred (InvalidRequestException) when calling the CreateSecret operation: You can't create this secret because a secret with this name is already scheduled for deletion.

Steps to Reproduce

terraform destroy followed quickly by a terraform apply

Notes

It appears that AWS has changed the message that occurs in the scenario when you use the force delete to match that when providing an explicit recovery window. This can be seen by running the AWS CLI in a script (one more more of the follow up create-secret calls will fail, but then one will succeed, followed by the obvious "secret already exists" error.

aws secretsmanager create-secret --name mysecret aws secretsmanager delete-secret --secret-id mysecret --force-delete-without-recovery aws secretsmanager create-secret --name mysecret aws secretsmanager create-secret --name mysecret aws secretsmanager create-secret --name mysecret aws secretsmanager create-secret --name mysecret

References

#5583

https://github.com/terraform-providers/terraform-provider-aws/blob/ca0991e63d765e5e4d801d4893a310fc2113d91a/aws/resource_aws_secretsmanager_secret.go#L111

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 27, 2019
@DrFaust92 DrFaust92 added the service/secretsmanager Issues and PRs that pertain to the secretsmanager service. label May 21, 2020
@anGie44 anGie44 removed the needs-triage Waiting for first response or review from a maintainer. label Feb 9, 2021
@anGie44
Copy link
Contributor

anGie44 commented Feb 9, 2021

Hi @richardgavel , thank you for creating this issue. I believe this has been fixed in versions as early as v2.0.0 of the terraform aws provider. I was able to reproduce your error with recovery_window_in_days=0 with v.1.60. of the provider, but in later versions I see recreate behavior works as expected. With that said, I'm going to close this issue, but if you are still experiencing this error with other terraform and/or terraform aws provider version combinations please create a new issue or comment back here with updates.

@anGie44 anGie44 closed this as completed Feb 9, 2021
@ghost
Copy link

ghost commented Mar 11, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/secretsmanager Issues and PRs that pertain to the secretsmanager service.
Projects
None yet
Development

No branches or pull requests

3 participants