Back to Skills

terraform-skill

Use when writing, reviewing, or debugging Terraform/OpenTofu modules, tests, CI, scans, or state ops - diagnoses failure mode (identity churn, secrets, blast radius, CI drift, state corruption) with version-aware guards.

2,024stars177forksUpdated 6/16/2026

Security Assessment

Critical Risk(25/100)

Detected risks:

Remote Code Execution([references/security-compliance.md] curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh)
Secret Exposure([references/code-patterns.md] password =, [references/security-compliance.md] password =, [references/security-compliance.md] password =)
Sensitive File Access([references/module-patterns.md] .env, [references/ci-cd-workflows.md] .env, [references/code-patterns.md] .env)
Security Score25/100

About terraform-skill

The Terraform Skill provides diagnose-first guidance for working with Terraform and OpenTofu infrastructure-as-code. It helps developers and DevOps engineers identify and resolve common failure modes before they cause production incidents. Rather than jumping straight to code generation, this skill analyzes the execution context, diagnoses the root cause category, and applies version-aware guardrails to ensure safe infrastructure changes.

The skill addresses seven critical failure categories: identity churn (resource address shifts during refactors), secret exposure (credentials leaked in state or logs), blast radius (oversized stacks affecting multiple environments), destroy cascades (unintended resource deletion), CI drift (local and CI plans diverging), compliance gaps (missing approvals or policy checks), and state corruption. For each category, it loads targeted reference material and generates fixes with explicit risk controls, rollback procedures, and validation commands.

Designed for infrastructure engineers managing Terraform/OpenTofu codebases, this skill enforces a response contract requiring assumption documentation, risk categorization, remediation rationale with tradeoffs, validation plans, and rollback notes. It prevents common mistakes like running destroy without plan review or applying directly to production without artifact approval. The skill supports both local and CI/CD workflows across multiple execution environments including Terraform Cloud and Atlantis.

FAQ

What Terraform and OpenTofu versions does this skill support?

The skill is version-aware and adapts guidance based on the runtime version you specify. It includes specific features for Terraform 1.1+ (moved blocks), Terraform 1.11+ (write-only arguments), and works with both Terraform and OpenTofu runtimes.

Does this skill make changes to my infrastructure automatically?

No. The skill generates Terraform/OpenTofu code, migration blocks, and CI configurations, but never runs apply commands automatically. It requires you to review plan outputs and explicitly confirm before any destructive operations, especially destroy commands.

How does the skill prevent secret exposure in Terraform state?

The skill diagnoses secret exposure risks by checking for secrets in defaults, state files, logs, and CI artifacts. It references security and compliance patterns, including write-only arguments for sensitive values, and provides remediation strategies to keep secrets out of state and version control.

Can this skill help migrate existing Terraform modules safely?

Yes. The skill specializes in identity churn prevention during refactors by generating moved blocks, helping choose between count and for_each patterns, and providing migration strategies that preserve resource addresses to avoid unnecessary destroy-and-recreate cycles.

What execution environments does this skill support?

The skill supports local execution, CI/CD pipelines, Terraform Cloud, and Atlantis workflows. It tailors validation commands and approval processes based on your execution environment and criticality level (dev, staging, production).

All Files

9 files
references/module-patterns.md22.4 KB
View
SKILL.md19.8 KB
View
references/ci-cd-workflows.md13.8 KB
View
references/testing-frameworks.md13.6 KB
View
references/code-patterns.md30.7 KB
View
references/security-compliance.md18.4 KB
View
references/state-management.md44.6 KB
View
references/code-intelligence-lsp.md6.6 KB
View
references/quick-reference.md19.1 KB
View

Install terraform-skill

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill