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.

State locking and how to handle it

See original GitHub issue

Community Note

  • Please vote on this issue by adding a šŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave ā€œ+1ā€ or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

cdktf & Language Versions

cdktf --version
0.0.13-pre.2f0b966cb25b6dc5066ee1551fdb32ff47a9c0fd

Affected Resource(s)

State and state locks

Expected Behavior

A way to escape a leaky abstraction of Terraform, directly with cdk-tf tooling. I don’t see any way to manage a local state directly with the cdktf cli.

Actual Behavior

I happened to have a state lock because I hard cancelled a deploy. Next deploy failed because of the lock. Manually deleting lock files didn’t really work. The CLI didn’t suggest any way to resolve the issue (I think Terraform actually helps you resolve locked states because of mistakes). I’m wondering if your aiming (for the future I know that this is alpha software) only for experienced Terraform devs or if this will be a tool that can fully abstract that it’s all Terraform under doing the hard work (like Pulumi does). I’m really missing state commands like the ones in Terraform.

Steps to Reproduce

Hard cancel a deploy (with a local state) and try to deal with the lock.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:11
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
akazakou-incommcommented, Oct 20, 2021

Hey. I’m using cdktf plan in CI and each time it locking state for all CI jobs. Can I disable locking? Seems that -lock=false will not work with cdktf ?

1reaction
logusgraphicscommented, Sep 13, 2021

For anyone encountering this issue. I went to the DynamoDB table where the locks are stored and remove the lock manually. That helped me re-run cdktf deploy <stack> successfully.

Read more comments on GitHub >

github_iconTop Results From Across the Web

State: Locking | Terraform - HashiCorp Developer
State locking happens automatically on all operations that could write state. You won't see any message that it is happening.
Read more >
How to manage Terraform state - Gruntwork Blog
In this post, you'll learn about how Terraform manages state and the impact that has on file layout, isolation, and locking in a...
Read more >
Terraform Remote Backend with State Locking in AWS and ...
What is Terraform Backend? A ā€œbackendā€ in Terraform determines the handling of the state and the way certain operations are executed, enabling many...
Read more >
Remote state and Locking using Terraform - DLT Labs
But how did Terraform know which resources it had been alleged to manage? The answer is ā€œterraform. tfstateā€. Think ā€œTerraform. tfstateā€ file asĀ ......
Read more >
Terraform State Locking with DynamoDB - YouTube
In this tutorial, we will demonstrate how to set up a Terraform backend using S3 and DynamoDB with state locking in 10 mins....
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