Terraform: Error locking state

If you have Terraform state locks. Sometimes cancelling terraform commands ungracefully might leave the state file locked. This is the error you would usually see if the lock is not released.


If you want to release this lock. You should run below command. Then type "yes" and hit enter.

terraform force-unlock <LOCK ID>

For example: 

terraform force-unlock 21e2b2bb-c123-2383-eece-7a5eaab4f645



Please don't release this lock, unless you are the once who caused it. It might corrupt the state file.