From terraform-skill
Use when writing, reviewing, or debugging Terraform/OpenTofu — modules, tests, CI/CD, security scans, or state operations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/terraform-skill:terraform-skillThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Use this skill when working with Terraform or OpenTofu infrastructure code. It diagnoses the failure mode first, then loads only the relevant reference file rather than preloading all context.
Use this skill when working with Terraform or OpenTofu infrastructure code. It diagnoses the failure mode first, then loads only the relevant reference file rather than preloading all context.
terraform test, Terratest, mock providers)circleci-to-github-actions-migration or github-actions-failure-triage| Situation | Use this skill? | Route instead |
|---|---|---|
| Terraform/OpenTofu module authoring, review, or debugging | Yes | — |
| GitHub Actions workflow for a non-Terraform project | No | circleci-to-github-actions-migration or github-actions-failure-triage |
| Security scan failures on non-IaC code | No | secret-scan-triage |
| General code navigation or LSP usage | No | code-intelligence |
| Root-cause debugging a specific Terraform failure | Yes (diagnose failure mode first) | systematic-debugging if the failure is not IaC-specific |
Required before starting
references/code-patterns.md)Helpful if present
versions.tf and .terraform.lock.hcl.github/workflows/, .circleci/config.yml)terraform plan outputOnly investigate if encountered
references/state-management.md)references/code-patterns.md before emitting any feature-specific HCL.Diagnose the failure mode first — load only the matching reference file:
| Failure mode | Symptoms | Load |
|---|---|---|
| Identity churn | Resource addresses shift after refactor, count index churn, missing moved blocks | references/code-patterns.md |
| Secret exposure | Secrets in defaults, state, logs, or CI artifacts | references/security-compliance.md, references/code-patterns.md, references/state-management.md |
| Blast radius | Oversized stacks, shared prod/non-prod state, unsafe applies | references/state-management.md, references/module-patterns.md |
| CI drift | Local plan ≠ CI plan, unpinned versions, no reviewed artifact | references/ci-cd-workflows.md, references/code-patterns.md |
| Compliance gaps | No policy stage, no approval model, no evidence retention | references/security-compliance.md, references/ci-cd-workflows.md |
| Testing blind spots | Plan-only computed values, set-type [0] indexing | references/testing-frameworks.md |
| State corruption/recovery | Stuck lock, backend migration, drift reconciliation | references/state-management.md |
| Provider upgrade risk | Breaking-change bump, unpinned modules | references/code-patterns.md, references/module-patterns.md |
| Provider lifecycle | Removing a provider with resources still in state | references/state-management.md |
| Navigation/safe rename | Cannot locate symbol definitions/refs semantically | references/code-intelligence-lsp.md |
Then follow these steps:
moved/import/removed blocks, CI changes, policy rules.fmt -check, validate, plan -out, policy check).moved/import/removed blocks, versions.tf, variable and output contractsfor_each keyed on a computed attribute (.id, .arn) — keys must be known at plan timesensitive = true keeps a value out of state — use ephemeral (1.10+) or write_only (1.11+) for state exclusionuse_lockfile = truemoved block (requires 1.1+)references/code-intelligence-lsp.md) before claiming an LSP operation is availableRun terraform fmt -check && terraform validate && terraform plan -out=tfplan in order
Run trivy config . or checkov -d . for security scans
Smoke-test trigger: "Create a Terraform module for an AWS S3 bucket with versioning and encryption" — skill should activate
Smoke-test near-miss: "Set up a GitHub Actions workflow for a Node.js project" — skill should not activate
Smoke test:
github-actions-failure-triage)moved blocks do I need?"| PROVENANCE.md | Skill provenance, changelog, and authorship |
references/code-patterns.md — count vs for_each, moved blocks, write-only args, Feature Guard Table (17 features with version floors and LLM error patterns)references/module-patterns.md — architecture principles, naming conventions, variable/output contracts, provider alias passingreferences/state-management.md — S3/Azure/GCS/TFC backends, native lock-file, migration, multi-team isolation, disaster recoveryreferences/testing-frameworks.md — static analysis, native terraform test (1.6+), Terratest, mock providers (1.7+)references/ci-cd-workflows.md — GitHub Actions, GitLab CI, Atlantis, Infracost, OIDC trust correctness table, drift detectionreferences/security-compliance.md — Trivy/Checkov, secrets handling, state-file hardening, IAM least-privilege, compliance mappingsreferences/quick-reference.md — command cheat sheets, decision flowcharts, Terraform vs OpenTofu comparison, troubleshootingreferences/code-intelligence-lsp.md — terraform-ls capability matrix, position-anchored LSP calls, degradation gate, manual rename protocolCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub matt-riley/lucky-hat --plugin terraform-skill