'terraform statefile is locked how do I unlock it [closed]
I have used terraform
state list but it is showing that you can't read due to tfstate
file is locked.
How do I unlock and get state of deploying resources?
Error: Error loading state: Failed to read state file: The state file could not be read: read terraform.tfstate: The process cannot access the file because another process has locked a portion of the file.
Solution 1:[1]
You can manually unlock the state using the force-unlock command :
terraform force-unlock LOCK_ID
The lock ID is generally shown in the error message.
It may not work if your state is local and locked by a local process. If it is the case, try killing that process and retry.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jean-Philippe Bond |