The command
tofu force-unlock LOCK_ID
The lock ID is shown in the error message of the blocked run. -force skips the confirmation prompt.
What the docs say it does — and doesn't
- It does not modify your infrastructure; it only removes the lock.
- Its behaviour depends on the backend you use.
- Local state files cannot be unlocked by another process.
- If your backend or encryption configuration uses variables, pass their values to the command.
Before you run it
- Check that no plan or apply is still running — in CI, on a colleague's laptop, anywhere.
- Remember that the lock protects state from two writers at once. Removing it while a run is active can corrupt state.
- Afterwards, run a plan to confirm the state looks as expected.
The checks above are our practice, not part of the official docs. If locks get stuck often, the real fix is to run applies only from CI.
Examples use OpenTofu (tofu); in Terraform the commands start with terraform. Check the documentation for your version before relying on a feature.