terraform-skill

Diagnose and remediate Terraform and OpenTofu failures with version-aware workflow guidance.

1|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/filippolmt/skills --skill terraform-skill-filippolmt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraform-skill
Source: https://github.com/filippolmt/skills/tree/main/skills/terraform-skill
Command: npx skills add https://github.com/filippolmt/skills --skill terraform-skill-filippolmt

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Terraform and OpenTofu work fails in predictable ways — identity churn after refactors, secrets leaking into state, oversized blast radius, CI drift, and state corruption — and generic advice often ignores the runtime version, causing destroy/recreate surprises or invalid plans. ## Core Features & Use Cases - Diagnose-first routing: A failure-category table maps symptoms (identity churn, secret exposure, destroy cascades, CI drift, testing blind spots) to the exact reference file needed, so only relevant depth is loaded. - Version-aware guards: Feature floors for moved blocks (1.1+), native tests (1.6+), mock providers (1.7+), S3 native locking (1.10+), and write_only arguments (1.11+) prevent emitting code the runtime cannot run. - Response contract: Every answer includes assumptions, risk category, remediation tradeoffs, a validation plan, and rollback notes; destructive operations require a reviewed plan -destroy first. - Use Case: When a count-to-for_each refactor threatens to recreate production subnets, the skill generates moved blocks and a verification plan showing zero destroy operations. ## Quick Start Ask the assistant to review your Terraform module for state and security risks, mentioning your Terraform or OpenTofu version and backend.

Frequently Asked Questions about terraform-skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor Terraform resources without destroying them?

Use `moved` blocks (Terraform 1.1+) in the same change as the rename, then run `terraform plan` to confirm it shows a move operation rather than destroy/create. For `count` to `for_each` migrations, add one `moved` block per index-to-key mapping.

Should I use count or for_each in Terraform?

Use `for_each` with stable keys whenever collection identity matters, since removing an element leaves other addresses untouched. Reserve `count = condition ? 1 : 0` for optional singletons or when keys cannot be known at plan time.

Does sensitive = true keep secrets out of Terraform state?

No. `sensitive = true` only masks display in terminal output; the value is still written to state. On Terraform 1.11+ use `write_only` arguments, on 1.10+ use `ephemeral` values, or source secrets from an external secret manager at runtime.

Does this skill work with OpenTofu as well as Terraform?

Yes. Both runtimes are supported, with guidance on licensing, governance, and feature deltas. OpenTofu starts at the 1.6 feature line, so native tests and later features apply to both.

Why does my Terraform plan differ between local runs and CI?

CI drift usually comes from unpinned provider or runtime versions, an uncommitted `.terraform.lock.hcl`, or re-running `plan` inside the apply job. Pin versions, commit the lockfile, and apply the reviewed plan artifact from the plan stage.

When should I not use this Terraform skill?

Skip it for basic HCL syntax questions, provider API reference lookups better served by official docs, and cloud-platform questions unrelated to Terraform or OpenTofu configuration.