Terraform Error acquiring the state lock: ConditionalCheckFailedException?

If supported by the backend, terraform generally locks your tfstate files so that only one user can operate on your terraform state at once. Terraform generally automatically release the lock once the intended operation on the state file is over, which also helps terraform avoid corrupted state files. But sometimes due to network or any other issue your terraform state file lock remains even though the particular session that acquired the lock is ended. In this situation, you get the error acquiring the state lock: ConditionalCheckFailedException. You can use terraform force-unlock command to remove the lock.

Error message:

Error resolution:

This Post Has One Comment

  1. Avatar
    Mansur

    I ran into the same issue when i was using terraform with S3 and dynamodb backend

    **Reason** : i forcefully terminate apply process that actually prevents me to aquire the lock again

    **Solution** : when it gets fail it return an ID with the ID we can unlock forcefully

    terraform force-unlock -force 6638e010-8fb0-46cf-966d-21e806602f3a

Leave a Reply