[Solved] Error acquiring the state lock in Terraform
If you have been handed the Acquiring state lock
error message about ConditionalCheckFailedException: The conditional request
then you have 2 options for fixing it!
The error looks something like this:
|
|
There are 3 possible ways to fix this
In short, you want to delete the lock associated. This is achieved by forcing an unlock.
Option 1: Force Unlock – Recommended
You can force unlock the state using the following:
|
|
Option 2: Relaunch the Plan
You can run the plan again with a -lock=false
as following:
|
|
Option 3: Make sure you use the right profile!
Sometimes everything seems correct, but it turns out you are using a different profile!
|
|
Force Unlock still not working?
Sometimes you can get another error when trying to force unlock this:
Failed to unlock state: failed to retrieve lock info: unexpected end of JSON input
This usually means that you are in the wrong terraform workspace.
View all workspaces available: terraform workspace list
Switch to a workspace: terraform workspace select <>
Now you can try and force unlock
again.
If you were successful, then you will get the following message: