Terraform State Lock

I cannot unlock my enviroment. 

user@lclayton19772:~/docker$ terraform plan

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.

  • post-author-pic
    Michael M


    The issue may be related to the permissions for the user that is attempting to run the commands. If the directory that contains the terraform code is read-only for the user that is processing the commands this could result in the error that you are seeing.  
    This user can be different from the user that is invoking the commands and may require some log inspection to see where the . "permission denied" is being generated.

Looking For Team Training?

Learn More