Case

Terraform: State lock blocks apply

State lock investigation and recovery to continue safe Terraform operations.

Case Summary

  • ProblemTerraform apply fails because the state is locked (previous run interrupted or concurrent applies).
  • SolutionConfirm no active apply is running, then unlock safely and rerun plan/apply.
  • Toolsterraform plan/apply · terraform force-unlock · remote state locking
  • OutcomeDeployments continue safely without state corruption.

Commands used (examples)

kubectl get pods -n <ns>
kubectl describe pod <pod> -n <ns>
kubectl logs <pod> -n <ns> --previous
kubectl get events -n <ns> --sort-by=.lastTimestamp | tail
systemctl status <service> --no-pager
journalctl -u <service> -n 200 --no-pager