- Home
- Skills
- DevOps & Cloud
- Repair Terraform State Lock Lease Orphan
More screenshots
Works with the AI Agents you already use
Repair Terraform State Lock Lease Orphan
Diagnose stale Terraform remote state locks without risking concurrent infrastructure writes.
$1
Repair Terraform State Lock Lease Orphan
Example session with this skill installed
A CI job crashed and later Terraform plans report a locked state while no worker appears active.
Available evidence: Terraform backend settings and lock owner metadata (partial extracts only). Additional sources requested: pipeline run history and state revision timestamps. Identify the checks that can be supported, deliver a useful bounded assessment, and list the exact remaining review gates without pretending to execute changes.
- Read your context and instructions
- Compiled the repair terraform state
Repair Terraform State Lock Lease Orphan — EVIDENCE-LIMITED REVIEW
Scenario received
A CI job crashed and later Terraform plans report a locked state while no worker appears active.
Evidence inventory
- S1: Terraform backend settings — partial extract described by the requester; original full source not provided here.
- S2: lock owner metadata — partial extract described by the requester; original full source not provided here.
- S3: pipeline run history — NOT PROVIDED; required to validate dependent findings.
- S4: state revision timestamps — NOT PROVIDED; required to validate dependent findings.
Case-specific checks
Identify lock lease ownership. INCOMPLETE until matching source anchors can be examined; document the observable facts, counterexamples and decision gate.
2.
Compare active run and provider telemetry. INCOMPLETE until matching source anchors can be examined; document the observable facts, counterexamples and decision gate.
3.
Distinguish stale from valid locks. INCOMPLETE until matching source anchors can be examined; document the observable facts, counterexamples and decision gate.
4.
Propose approved recovery with rollback gates. INCOMPLETE until matching source anchors can be examined; document the observable facts, counterexamples and decision gate.
Deliverables
Lock custody timeline. Create an evidence-linked section with observations, missing data, owner and next validation step.
Safe recovery decision tree. Create an evidence-linked section with observations, missing data, owner and next validation step.
Post recovery drift validation. Create an evidence-linked section with observations, missing data, owner and next validation step.
Acceptance gate
No lock release is recommended until active writers and state snapshot integrity are independently checked. Do not label this gate passed until supplied source records actually demonstrate it.
Verdict and next action
INCOMPLETE — evidence required. Request S3 and S4 from the authorized owner, reconcile them with S1 and S2, then repeat the four checks and log remaining conflicts. No production change, approval, communication, or test run is claimed.
Connects securely to your tools. The creator never sees your data.
About this skill
CI/CD crashes often leave Terraform state locks orphaned, blocking all subsequent deployments and causing pipeline gridlock. This skill provides a systematic diagnostic framework to identify stale locks without risking the data corruption that comes from force-unlocking an active process.
What it does
- Identify lock ownership by analyzing backend settings and lock metadata to find the specific process or user holding the lease.
- Correlate telemetry by comparing pipeline run history against provider logs to detect crashed workers.
- Validate lock status by distinguishing between truly stale orphans and active, slow-running infrastructure changes.
- Generate recovery trees by drafting approved recovery procedures including the exact
force-unlockcommands and rollback gates.
How it works
- Provide the Terraform backend configuration and the error message containing the Lock ID.
- Share relevant CI/CD logs or process timestamps to verify if the previous owner is still alive.
- Review the generated Lock Custody Timeline to confirm the lease is indeed orphaned.
- Execute the proposed recovery steps once state snapshot integrity is confirmed.
Frameworks & tools
This tool works with Terraform and OpenTofu configurations using remote backends like AWS S3 (with DynamoDB), Azure Blob Storage, or HashiCorp Cloud.
Why this beats prompting it yourself
Generic AI prompts often suggest a force-unlock immediately, which can corrupt state if a process is still writing. This skill enforces a strict evidence register and decision gate logic to ensure no release is recommended until active writers are independently verified.
Use cases
- Recovering from CI/CD runner timeouts that left a DynamoDB lock entry behind.
- Investigating "Error: Could not acquire lock" messages when no teammates are running plans.
- Validating state integrity after a network partition during a
terraform apply.
Known limitations
Requires manual provision of lock metadata and pipeline history. It cannot directly access cloud providers to perform the unlock; it only generates the safe diagnostic report.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for DevOps & Cloud.
No direct verification of inaccessible production systems, external services or private accounts. Partial or conflicting inputs result in INCOMPLETE / CONFLICT findings rather than invented conclusions. Domain-sensitive decisions require qualified owner review.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 26 days ago
Permissions
Provide only materials you are authorized to share. Use a reviewed environment for proposed changes; keep deployment, production modifications, and third-party communication under explicit human approval.