magic-modules icon indicating copy to clipboard operation
magic-modules copied to clipboard

Remove secret version from state if its status is DESTROYED

Open shuyama1 opened this issue 1 year ago • 6 comments

This should resolve https://github.com/hashicorp/terraform-provider-google/issues/12504

If this PR is for Terraform, I acknowledge that I have:

  • [ ] Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • [ ] Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • [ ] Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • [ ] Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • [ ] Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

secretmanager: fix a bug where `google_secret_manager_secret_version` that was destroyed outside of Terraform would not be recreated on apply

shuyama1 avatar Sep 22 '22 19:09 shuyama1

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 1 file changed, 20 insertions(+)) Terraform Beta: Diff ( 1 file changed, 20 insertions(+)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Sep 22 '22 20:09 modular-magician

Tests analytics

Total tests: 2176 Passed tests 1936 Skipped tests: 238 Failed tests: 2

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccComputeInstance_soleTenantNodeAffinities|TestAccCGCSnippet_eventarcWorkflowsExample

modular-magician avatar Sep 22 '22 21:09 modular-magician

Tests failed during RECORDING mode: TestAccComputeInstance_soleTenantNodeAffinities[Error message] [Debug log] TestAccCGCSnippet_eventarcWorkflowsExample[Error message] [Debug log]

Please fix these to complete your PR View the build log or the debug log for each test

modular-magician avatar Sep 22 '22 21:09 modular-magician

Looks reasonable. Do we already do something similar when we destroy the resource via Terraform?

Do you mean how we handle destroying the resource (that destroyed outside of Terraform) via Terraform before?

shuyama1 avatar Sep 23 '22 17:09 shuyama1

Looks reasonable. Do we already do something similar when we destroy the resource via Terraform?

Do you mean how we handle destroying the resource (that destroyed outside of Terraform) via Terraform before?

I mean how do we handle destroying this resource via Terraform if it goes into the DESTROYED state rather than actually being gone. I assume we just issue the delete request, see that it succeeds and then assume the resource is gone

slevenick avatar Sep 23 '22 17:09 slevenick

Yeah, we only check if the delete request return errors, but could not tell if the resource still exists but in DESTROYED state.

shuyama1 avatar Sep 23 '22 18:09 shuyama1