question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Saved plan does not match the given state

See original GitHub issue

cdktf & 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

https://www.terraform.io/enterprise/release/v202111-1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
IamRFC1918commented, Sep 15, 2022

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

1reaction
ansgarmcommented, Dec 17, 2021

I built a reproduction case using Terraform which works with 1.0.7 but fails with 1.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 Terraform 1.1.1.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found