All Tools View Categories About Contact Privacy

Terraform State Lock Analyzer

Paste a Terraform state lock and get a clear analysis.

Runs entirely in your browser - nothing is uploaded and no live connection (AWS/DynamoDB/Terraform Cloud) is made. This is a read-only analysis of pasted data.
Your lock analysis will appear here.

About Terraform State Lock Analyzer

A stuck Terraform state lock can bring an entire pipeline to a halt. When two engineers, a CI runner, and an automated apply all try to act on the same state, Terraform writes a lock to prevent corruption. If a process crashes or is cancelled abruptly the lock can be left behind, blocking every subsequent plan and apply for the whole team. The Terraform State Lock Analyzer reads whatever lock data you paste, whether that is an S3 backend lock file (terraform.tfstate.tflock), a DynamoDB lock item with a LockID, or unstructured text, and turns it into a clear, human readable summary. It tells you who currently holds the lock, which operation triggered it (a plan, an apply, or a destroy), which Terraform version created it, when it was created, and how long it has been held. Most importantly, it flags risky situations: apply locks (where a real change may be in flight) and stale locks that have been held far longer than any reasonable operation should take. All of this happens entirely in your browser. Nothing is uploaded, no AWS credentials are read, and no connection to Terraform Cloud is made. The tool is a read only diagnostic that helps you decide whether it is safe to force unlock, and how to do so without damaging your infrastructure. Use it during incidents to move fast and stay safe.

Features

  • S3 backend lock support - parses the terraform.tfstate.tflock JSON produced by the default S3 backend.
  • DynamoDB lock support - reads DynamoDB items that expose a LockID plus an embedded Info blob.
  • Plain text fallback - when JSON parsing fails, the raw lock text is shown verbatim so nothing is lost.
  • Field extraction - surfaces the lock ID, operation type, holding principal, Terraform version and creation timestamp.
  • Operation detection - recognizes OperationTypePlan, OperationTypeApply and OperationTypeDestroy.
  • Age calculation - computes how many hours the lock has been held relative to the current time.
  • Apply risk warning - warns when an apply lock is active because a change may be in progress.
  • Stale lock detection - flags locks older than twenty four hours as suspicious.
  • Force unlock guidance - prints the exact terraform force-unlock command with the lock ID.
  • Read only safety - never contacts AWS, never modifies state, never forces anything itself.
  • Copy, download and print - export the analysis as text, a file, or a printed report.

How to Use

  1. Copy the lock payload from your backend. For S3, grab the contents of terraform.tfstate.tflock. For DynamoDB, export the item that contains the LockID attribute.
  2. Paste the payload into the text area on the left side of the tool. You can paste JSON directly or any lock note you have from logs.
  3. Optionally click Load sample to see the expected shape using a realistic apply lock example.
  4. Click Analyze lock to run the parser. The tool validates the input and reports an error if the payload is empty.
  5. Review the structured analysis on the right. It shows the lock type, lock ID, operation, who holds it, Terraform version and creation time.
  6. Read the findings section carefully. If an apply lock is reported, confirm no run is currently active before doing anything.
  7. If the lock is stale, copy the suggested force-unlock command and run it from your terminal only after verification.
  8. Use Copy, Download or Print to keep a record of the analysis for your incident notes or a teammate.

Examples

Example 1 shows an S3 backend lock created by an apply operation. Pasting the tflock JSON returns a lock type of S3 backend lock, the lock ID a1b2c3, the operation OperationTypeApply, the principal alice@ci-runner, and a warning that an apply may be in progress. Example 2 shows a DynamoDB item whose LockID points at mybucket/path/to/terraform.tfstate and whose Info field embeds a JSON blob describing a plan operation held by bob@host. Both examples are produced locally with no cloud calls. The analysis explains exactly what each field means and what action, if any, is safe.

Benefits

  • Fast clarity - decode opaque lock JSON into plain language in seconds.
  • Safer operations - explicit apply and stale warnings stop you from force unlocking blindly.
  • Fully private - runs in the browser, no credentials, no network.
  • Portable output - copy, download or print the report for handoff.
  • Learning aid - understand the lock schema without reading Terraform source.

Frequently Asked Questions

What inputs does it accept?
A Terraform state lock file (terraform.tfstate.tflock), a DynamoDB lock item (JSON with a LockID), or any pasted lock text.
What does it report?
The lock type, lock ID, operation, who holds it, Terraform version, creation time and an age/risk assessment.
Does it connect to AWS or Terraform?
No. It only parses the text you paste. Nothing is uploaded and no live connection is made.
How do I release a stuck lock?
After confirming no run is active, use `terraform force-unlock <LOCK_ID>`. The tool only advises; it never touches your infrastructure.