Skip to content

gracefullight/pkgs / .agents/skills/oma-tf-infra

oma-tf-infra

Verified

Create or review Terraform infrastructure and plans. Use for cloud resources, IAM, networking, state management, and infrastructure changes.

resources/error-playbook.md

View on GitHub
# TF Infra Agent: Error Recovery Playbook

## State Lock Error
**Symptom:** `Error acquiring the state lock`
**Recovery:**
1. Check who holds the lock: `terraform force-unlock <LOCK_ID>` (use with caution)
2. Verify no other terraform process is running
3. If stale lock, confirm and force-unlock

## Resource Already Exists
**Symptom:** `Error: already exists` on create
**Recovery:**
1. Import the existing resource. On Terraform >= 1.5, prefer a config-driven `import` block (plannable and reviewable):
   ```hcl
   import {
     to = aws_s3_bucket.assets
     id = "my-existing-bucket"
   }
   ```
   On older versions, use the CLI: `terraform import <resource_type>.<name> <id>`
2. Verify imported state matches config: `terraform plan`
3. Adjust config if drift exists
4. For refactors, use `moved` blocks (rename/move without recreate) and `removed` blocks (TF >= 1.7, drop from state without destroying)

## Permission Denied
**Symptom:** `AccessDenied`, `403 Forbidden`, `insufficient permissions`
**Recovery:**
1. Check current identity:
   - AWS: `aws sts get-caller-identity`
   - GCP: `gcloud auth list`
   - Azure: `az account show`
   - OCI: `oci iam region list`
2. Verify IAM policies attached to the identity
3. Add missing permissions following least privilege

## Provider Version Conflict
**Symptom:** `Incompatible provider version` or `Could not retrieve the list of available versions`
**Recovery:**
1. Update version constraint in `versions.tf`
2. Run `terraform init -upgrade`
3. Review changelog for breaking changes

## Drift Detected
**Symptom:** `terraform plan` shows unexpected changes on existing resources
**Recovery:**
1. Run `terraform plan -refresh-only` to review drift (the standalone `terraform refresh` command is deprecated — it updates state without confirmation)
2. If the detected changes are correct, sync state with `terraform apply -refresh-only`
3. If manual changes exist, decide: import to state or revert manual change

## Wrong Provider Configuration
**Symptom:** Resources targeting wrong region/project/subscription
**Recovery:**
1. Check `provider.tf` for region/project/subscription settings
2. Check `backend.tf` for state configuration
3. Use provider aliases for multi-region setups

## Module Source Error
**Symptom:** `Module not found` or `Failed to download module`
**Recovery:**
1. Check module source path (local) or registry URL (remote)
2. For git sources, verify access credentials
3. Run `terraform init` to re-download modules

## General Principles
- After 3 consecutive failures on the same issue, try a fundamentally different approach
- Check cloud provider status pages for service outages
- Never modify `terraform.tfstate` manually; use `terraform state mv` / `terraform state rm` for state surgery
- Always backup state before destructive operations: `terraform state pull > backup.tfstate`
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall