-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
[#19212] Fix secretsmanager_secret_version update #19943
[#19212] Fix secretsmanager_secret_version update #19943
Conversation
01fd86a
to
6510566
Compare
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.
Welcome @syndbg 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
6510566
to
bb12b21
Compare
bb12b21
to
a66e804
Compare
Fixes the AWS SecretsManager API call failing when there's a drift between the Terraform state and SecretsManager "state". The drift is caused by someone/something updating outside of Terraform the given resource. E.g AWS SecretsManager CLI or AWS SecretsManager Web UI/Console
a66e804
to
89d24dd
Compare
Any chance you can take a look at this? @ewbankkit @bill-rich 👀 |
Is there anything missing/done wrong in the PR? We (https://github.com/sumup) kinda need this fix. |
Pull request #21306 has significantly refactored the AWS Provider codebase. As a result, most PRs opened prior to the refactor now have merge conflicts that must be resolved before proceeding. Specifically, PR #21306 relocated the code for all AWS resources and data sources from a single We recognize that many pull requests have been open for some time without yet being addressed by our maintainers. Therefore, we want to make it clear that resolving these conflicts in no way affects the prioritization of a particular pull request. Once a pull request has been prioritized for review, the necessary changes will be made by a maintainer -- either directly or in collaboration with the pull request author. For a more complete description of this refactor, including examples of how old filepaths and function names correspond to their new counterparts: please refer to issue #20000. For a quick guide on how to amend your pull request to resolve the merge conflicts resulting from this refactor and bring it in line with our new code patterns: please refer to our Service Package Refactor Pull Request Guide. |
@syndbg, are you able to resolve the conflicts on this PR, as this issue still exists. |
This reverts commit 89d24dd.
…f 'AWSPREVIOUS' as deleted.
…SecretVersion_multipleVersions'.
% make testacc TESTARGS='-run=TestAccSecretsManagerSecretVersion_multipleVersions' PKG=secretsmanager ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./internal/service/secretsmanager/... -v -count 1 -parallel 20 -run=TestAccSecretsManagerSecretVersion_multipleVersions -timeout 360m === RUN TestAccSecretsManagerSecretVersion_multipleVersions === PAUSE TestAccSecretsManagerSecretVersion_multipleVersions === CONT TestAccSecretsManagerSecretVersion_multipleVersions --- PASS: TestAccSecretsManagerSecretVersion_multipleVersions (18.29s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager 24.282s
% make testacc TESTARGS='-run=TestAccSecretsManagerSecretVersion_versionStagesExternalUpdate' PKG=secretsmanager ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./internal/service/secretsmanager/... -v -count 1 -parallel 20 -run=TestAccSecretsManagerSecretVersion_versionStagesExternalUpdate -timeout 360m === RUN TestAccSecretsManagerSecretVersion_versionStagesExternalUpdate === PAUSE TestAccSecretsManagerSecretVersion_versionStagesExternalUpdate === CONT TestAccSecretsManagerSecretVersion_versionStagesExternalUpdate secret_version_test.go:148: Step 2/2 error: Error running apply: exit status 1 Error: adding Secrets Manager Secret Version (arn:aws:secretsmanager:us-west-2:187416307283:secret:tf-acc-test-6730888995458695428-SDqgH6|terraform-20240117143626546000000002) stage (AWSCURRENT): operation error Secrets Manager: UpdateSecretVersionStage, https response error StatusCode: 400, RequestID: ca7aa42b-4d72-4bf3-80f4-ba679691182e, InvalidParameterException: The parameter RemoveFromVersionId can't be empty. Staging label AWSCURRENT is currently attached to version e307a6be-8c34-400a-9154-c6908e71788b, so you must explicitly reference that version in RemoveFromVersionId. with aws_secretsmanager_secret_version.test, on terraform_plugin_test.tf line 16, in resource "aws_secretsmanager_secret_version" "test": 16: resource "aws_secretsmanager_secret_version" "test" { --- FAIL: TestAccSecretsManagerSecretVersion_versionStagesExternalUpdate (20.48s) FAIL FAIL github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager 25.941s FAIL make: *** [testacc] Error 1
…The parameter RemoveFromVersionId can't be empty. Staging label AWSCURRENT is currently attached to version ..., so you must explicitly reference that version in RemoveFromVersionId` errors when a secret is updated outside Terraform.
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 🚀.
% make testacc TESTARGS='-run=TestAccSecretsManagerSecretVersion_' PKG=secretsmanager ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/secretsmanager/... -v -count 1 -parallel 3 -run=TestAccSecretsManagerSecretVersion_ -timeout 360m
=== RUN TestAccSecretsManagerSecretVersion_basicString
=== PAUSE TestAccSecretsManagerSecretVersion_basicString
=== RUN TestAccSecretsManagerSecretVersion_base64Binary
=== PAUSE TestAccSecretsManagerSecretVersion_base64Binary
=== RUN TestAccSecretsManagerSecretVersion_versionStages
=== PAUSE TestAccSecretsManagerSecretVersion_versionStages
=== RUN TestAccSecretsManagerSecretVersion_versionStagesExternalUpdate
=== PAUSE TestAccSecretsManagerSecretVersion_versionStagesExternalUpdate
=== RUN TestAccSecretsManagerSecretVersion_disappears
=== PAUSE TestAccSecretsManagerSecretVersion_disappears
=== RUN TestAccSecretsManagerSecretVersion_Disappears_secret
=== PAUSE TestAccSecretsManagerSecretVersion_Disappears_secret
=== RUN TestAccSecretsManagerSecretVersion_multipleVersions
=== PAUSE TestAccSecretsManagerSecretVersion_multipleVersions
=== CONT TestAccSecretsManagerSecretVersion_basicString
=== CONT TestAccSecretsManagerSecretVersion_disappears
=== CONT TestAccSecretsManagerSecretVersion_versionStages
--- PASS: TestAccSecretsManagerSecretVersion_disappears (19.03s)
=== CONT TestAccSecretsManagerSecretVersion_multipleVersions
--- PASS: TestAccSecretsManagerSecretVersion_basicString (22.62s)
=== CONT TestAccSecretsManagerSecretVersion_base64Binary
--- PASS: TestAccSecretsManagerSecretVersion_multipleVersions (20.49s)
=== CONT TestAccSecretsManagerSecretVersion_Disappears_secret
--- PASS: TestAccSecretsManagerSecretVersion_base64Binary (21.78s)
=== CONT TestAccSecretsManagerSecretVersion_versionStagesExternalUpdate
--- PASS: TestAccSecretsManagerSecretVersion_versionStages (49.04s)
--- PASS: TestAccSecretsManagerSecretVersion_Disappears_secret (18.05s)
--- PASS: TestAccSecretsManagerSecretVersion_versionStagesExternalUpdate (27.47s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/secretsmanager 81.236s
@syndbg Thanks for the contribution 🎉 👏. |
This functionality has been released in v5.33.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! |
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 issues. |
Fixes the AWS SecretsManager API call failing when there's a drift
between the Terraform state and SecretsManager "state".
The drift is caused by someone/something updating outside of Terraform the given resource.
E.g AWS SecretsManager CLI or AWS SecretsManager Web UI/Console
Community Note
Closes #19212.
Output from acceptance testing: