Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

[Bug] Single subscription deployment lab failing Destroy #433

Open
CarlosAugustoDeSouzaJunior opened this issue Nov 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@CarlosAugustoDeSouzaJunior

Describe the bug

Cannot destroy deployment.

To Reproduce

Deploy until level1/alz/mg/ , and try to destroy after.

rover
--impersonate-sp-from-keyvault-url https://ida-kv-es-qfg.vault.azure.net/
-lz /tf/caf/landingzones/caf_solution/add-ons/caf_eslz
-var-folder /tf/caf/configuration/level1/alz/mg
-tfstate_subscription_id e91f64d9-79ca-4bc7-a8de-b205ec4f0854
-tfstate alz_mg.tfstate
-env idahys
-level level1
-p ${TF_DATA_DIR}/alz_mg.tfstate.tfplan
-a apply

The apply is successful, bur cannot destroy
àrover
--impersonate-sp-from-keyvault-url https://ida-kv-es-qfg.vault.azure.net/
-lz /tf/caf/landingzones/caf_solution/add-ons/caf_eslz
-var-folder /tf/caf/configuration/level1/alz/mg
-tfstate_subscription_id e91f64d9-79ca-4bc7-a8de-b205ec4f0854
-tfstate alz_mg.tfstate
-env idahys
-level level1
-p ${TF_DATA_DIR}/alz_mg.tfstate.tfplan
-a destroy

Error:

Terraform has been successfully initialized!
Line 468 - Terraform init return code 0
Terraform version 0.15 or greater

│ Error: Saved plan is stale

│ The given plan file can no longer be applied because the state was changed by another operation after the plan was
│ created.

Error on or near line 489: Error running terraform destroy; exiting with status 1

The only thing I saw, the subscription was moved to inside level, even If I move the subscription back, it still not working. I have to remove everything by other scripts....

Expected behavior

destroy level1/alv/mg , configuration.

Screenshots
If applicable, add screenshots to help explain your problem.

Configuration (please complete the following information):

  • OS and version: [e.g. Windows 10 1909]
  • Version of the rover[e.g. 22]
  • Version of the landing zone[e.g. 11]

Additional context
Add any other context about the problem here.

@CarlosAugustoDeSouzaJunior CarlosAugustoDeSouzaJunior added the bug Something isn't working label Nov 28, 2022
@so-development
Copy link

I had the same problem (for level 2). I was using the dev container image aztfmod/rover:1.2.5-2208.0208. After upgrading to aztfmod/rover:1.3.4-2211.2307 the destroy command worked for me.
I also didn't need to pass the tfplan file with-p - just -a destroy. Rover will automatically create a destroy plan using the Terraform command plan -destroy and applies it afterwards.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants