-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get the lock id? #17535
Comments
Hi @robsonpeixoto, Thanks for filing this. For most backends, the error message would indicate exactly what the lock ID was. In this case, the metadata blob is missing altogether, so terraform never gets to print the lock information. I believe, as you've guessed, that the lock ID is also the lease RequestID, but in your case the failure to fetch the lock info causes the unlock to abort before the lease can be released. Unfortunately I'm not really familiar with azurerm, but there might be some method through the web console or cli to release the lease on the state blob itself. @tombuildsstuff, do you what the easiest workaround for this might be, until I get a patch into the backend? |
hey @robsonpeixoto So there's a workaround for this issue in this comment - but this can either be done using the Azure CLI or the Azure Blob Storage Explorer, by releasing the lock on the file. There's a separate task to update the AzureRM Backend to workaround this issue which is being tracked in #17046. |
Thanks @tombuildsstuff. |
It sounds like the other discussions Tom linked have workarounds to get you what you need here in the short term, @robsonpeixoto, so I'm going to close this issue just to consolidate the discussion over in #17046. Sorry for the weird behavior here, and thanks for reporting it! |
This is a true story! It happened to I have a project that spans both AWS and GCP, the tfstate is stored on GCP in a cloud storage bucket (p.s. that is so much nicer than the AWS solution involving dynamoDB). My environment requires temporary credentials & token for AWS. I've noticed that when I run My hokey-pokey jig is to cancel the It's probably the second time I hit control+C that is the cause of this problem; terraform is even kindly warning me that the first time it shuts down gracefully (but I am too impatient for that) and the second time just exits abruptly. It's the correct behaviour, P.E.B.K.A.C. Move along nothing to see. |
I had that same problem with AWS. Looking into the dynamo db table to see the ID there was working, but I guess when I'm there already I can also just delete the entry right there!? |
rename your terraform.tfstate file. Looks like it got corrupted Error: Error locking state: Error acquiring the state lock: open terraform.tfstate: permission denied Terraform acquires a state lock to protect the state from being written by multiple users at the same time. Please resolve the issue above and try again. For most commands, you can disable locking with the "-lock=false" flag, but this is not recommended. aryan@aryan-VirtualBox:~/docker$ ls main.tf terraform.tfstate aryan@aryan-VirtualBox:~/docker$ ll total 20 drwxr-xr-x 3 aryan aryan 4096 May 7 14:07 ./ drwxr-xr-x 21 aryan aryan 4096 May 7 13:57 ../ -rw-r--r-- 1 aryan aryan 279 May 7 13:57 main.tf drwxr-xr-x 3 aryan aryan 4096 May 7 12:26 .terraform/ -rw-r--r-- 1 root root 1161 May 7 12:37 terraform.tfstate aryan@aryan-VirtualBox:~/docker$ ls .terraform/ plugins aryan@aryan-VirtualBox:~/docker$ less terraform.tfstate aryan@aryan-VirtualBox:~/docker$ mv terraform.tfstate old_terraform.tfstate |
I ran this from a command prompt in PowerShell and it unlocked my file: $ Get-Process terraform | Stop-Process -force |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
I need to force a unlock, but how to get the lock id?
The text was updated successfully, but these errors were encountered: