Error: Saved plan does not match the given state
See original GitHub issuecdktf & Language Versions
Terraform v1.1.0 on darwin_amd64 “@cdktf/provider-docker”: “^0.5.12”, “cdktf”: “^0.8.3”,
Expected Behavior
cdktf destroy typescript-docker
Destroying Stack: typescript-docker
Resources
✔ DOCKER_CONTAINER nginxContainer docker_container.nginxContainer
✔ DOCKER_IMAGE nginxImage docker_image.nginxImage
Summary: 2 destroyed.
Actual Behavior
cdktf destroy typescript-docker
⠦ planning typescript-docker...
[2021-12-16T00:55:05.684] [ERROR] default - ╷
│ Error: Saved plan does not match the given state
│
│ The given plan file can not be applied because it was created from a
│ different state lineage.
Steps to Reproduce
Follow the steps from https://learn.hashicorp.com/tutorials/terraform/cdktf-install?in=terraform/cdktf
Once you get to the https://learn.hashicorp.com/tutorials/terraform/cdktf-install?in=terraform/cdktf#destroy-the-container step, you’ll get the Actual Behavior above.
Important Factoids
Ended up just using tfswitch to go back to v1.0.11. This worked fine.
References
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Terraform Apply Fails - Saved plan is stale - Harness Community
Error : Saved plan is stale │ │ The given plan file can no longer be applied because the state was changed │by...
Read more >Terraform show and plan not matching - Stack Overflow
Here's what I did - I modified the terraform state (the parent id) in the S3 bucket. Ensured that terraform show is reflecting...
Read more >Command: refresh | Terraform - HashiCorp Developer
The `terraform refresh` command reads the current settings from all managed remote objects and updates the Terraform state to match.
Read more >[Investigate]GitLab Managed Terraform State fails auth with ...
Try running "terraform plan" to see any changes that are required for your infrastructure. All Terraform commands should now work.
Read more >Managing Terraform State | Google Cloud Skills Boost
Review the Terraform plan to ensure that the configuration matches the expected state and infrastructure. Apply the configuration to update your Terraform ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @jdigory,
do you find a solution for that? I’m running in the same error, using Gitlab as http Backend and apply a plan if a state from a previous run exists.
I tested Version 1.0.11: Its working… It seams like a bug in newer Versions
I built a reproduction case using Terraform which works with
1.0.7
but fails with1.1.1
. I will create an issue over at the Terraform repo for that bug and keep this one here as it is still unclear whether the Terraform commands from the reproduction case are wrong or whether there was a regression in Terraform1.1.1
.