terraform apply fails with "Error acquiring the state lock" or "state is locked".
A previous apply crashed or is still running, leaving the lock held.
ps aux | grep terraform # never unlock mid-applyterraform force-unlock <LOCK-ID>S3 backend + DynamoDB lock (classic) or native S3 lockfilesOne apply pipeline per state; never run applies from two laptops.
Spinning up a fresh box to reproduce or escape this error?
Managed cloud hostingNinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.
Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog