Recover Terraform State Lock

Recover Terraform State Lock is a skill for Claude Code, Codex from bregman-arie/devops-sre-skills. It costs 17 tokens per session (413 once invoked), scanned A, original, Apache-2.0.

A recovery procedure for a Terraform state lock that prevents infrastructure changes. Terraform state is the record Terraform uses to track managed resources.

In plain words
What is it for?
Use it to inspect lock details, check active local or CI runs, safely force-unlock a stale lock, and run a plan to confirm the state remains consistent.
Why use it?
It helps determine whether another operation is still writing state, reducing the risk of corrupting it by unlocking too early.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect lock details, check active local or CI runs, safely force-unlock a stale lock, and run a plan to confirm the state remains consistent.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bregman-arie/devops-sre-skills/recover-state-lock
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add bregman-arie/devops-sre-skills --skill recover-state-lock
Clone the repo
git clone --depth 1 https://github.com/bregman-arie/devops-sre-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Recover Terraform State Lock

README.md
[![agentmods](https://agentmods.dev/badge/skills/bregman-arie/devops-sre-skills/recover-state-lock/github.svg)](https://agentmods.dev/skills/bregman-arie/devops-sre-skills/recover-state-lock)
Your own site
<a href="https://agentmods.dev/skills/bregman-arie/devops-sre-skills/recover-state-lock"><img src="https://agentmods.dev/badge/skills/bregman-arie/devops-sre-skills/recover-state-lock/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Recover Terraform State Lock

Your own site · 80×15
<a href="https://agentmods.dev/skills/bregman-arie/devops-sre-skills/recover-state-lock"><img src="https://agentmods.dev/badge/skills/bregman-arie/devops-sre-skills/recover-state-lock.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 413 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00017 $0.00413
Opus 5 $0.00009 $0.00206
Sonnet 5 $0.00003 $0.00083
Haiku 4.5 $0.00002 $0.00041

Measured 11d ago against content hash 12b0d209d5fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

Recover Terraform State Lock scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/terraform/recover-state-lock/SKILL.md · 66 lines

What it actually says

When to use

Use when Terraform reports the state is locked and operations cannot proceed.

Preconditions

  • You have access to the workspace and can identify the last run/operator.
  • You understand the blast radius of forcing an unlock.

Procedure

  1. Determine whether a Terraform operation is currently running (CI runner, TFC/TFE run, local terminal).
  2. Identify lock metadata (who/when/operation).
  3. If a run is active, wait or stop it cleanly.
  4. If the lock is stale, coordinate and force-unlock only after confirming no active writers.
  5. Run a plan to confirm state consistency.

Decision points

  • Active run present: do not force-unlock.
  • Stale lock (no active run, old timestamp): force-unlock may be appropriate.
  • Repeated lock issues: investigate backend connectivity and CI cancellation behavior.

Verification

  • A new terraform plan completes successfully.
  • No concurrent runs are writing to state.

Rollback / undo

  • If state becomes inconsistent, restore from backend versioning/snapshots.
  • If a partial apply occurred, reconcile with a fresh plan and targeted remediation.

Escalation

  • Escalate to platform/IaC owners if unlock requires backend admin privileges.
  • Escalate if state corruption is suspected.

Examples

terraform plan
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 66 lines · 17 tokens per session scan A 12b0d209d5fe

Subscribe to this mod's changes

Recover Terraform State Lock is a skill published in the GitHub repository bregman-arie/devops-sre-skills (22 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 17 tokens to every session and 413 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

auditing-terraform-infrastructure-for-security

Auditing Terraform infrastructure-as-code for security misconfigurations using Checkov, tfsec, Terrascan, and OPA/Rego policies to detect overly permissive IAM policies, public resource exposure, missing encryption, and insecure defaults before cloud deployment.

xalgorix/xalgorix · 59 tokens

implementing-infrastructure-as-code-security-scanning

This skill covers implementing automated security scanning for Infrastructure as Code (IaC) templates using tools like Checkov, tfsec, and KICS. It addresses detecting misconfigurations in Terraform, CloudFormation, Kubernetes manifests, and Helm charts before deployment, establishing policy-based governance, and…

xalgorix/xalgorix · 81 tokens

k8s-incident-triage

Read-only Kubernetes incident triage using kubectl. Accepts natural language or structured input. Produces root-cause hypotheses, evidence, and next-step commands.

initializ/forge · 41 tokens

Cloud Security & Container Hardening

AWS/Azure/GCP security auditing, container and Kubernetes hardening, Infrastructure as Code scanning, and cloud compliance assessment.

Masriyan/Claude-Code-CyberSecurity-Skill · 30 tokens

huawei-cloud-solution-ops

A skill for Huawei Cloud solution operations. It helps agents inspect, plan, operate, troubleshoot, and verify Huawei Cloud resources through hcloud, Huawei Cloud SDKs, Terraform, and MaaS capabilities. Use this when users want to query or change Huawei Cloud resources, troubleshoot authentication and API issues…

huaweicloud/huaweicloud-skills · 81 tokens

huawei-cce

Use when creating or managing CCE Kubernetes clusters. Covers cluster creation, node pools, SWR registry, autoscaling. Triggers: CCE, Kubernetes, K8s, cluster, node pool, container, SWR. NOT for: serverless functions (use huawei-functiongraph), serverless containers (use huawei-cce for CCI redirect).

huaweicloud/huaweicloud-devkit · 78 tokens