terraform-skill

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

Updated Aug 1, 2026
One-click install
npx skills add https://github.com/siegenthalerroger/.llmctl-marketplace --skill terraform-skill-siegenthalerroger
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: terraform-skill
Source: https://github.com/siegenthalerroger/.llmctl-marketplace/tree/main/plugins/llmctl-ops-0.2.1/skills/terraform-skill
Command: npx skills add https://github.com/siegenthalerroger/.llmctl-marketplace --skill terraform-skill-siegenthalerroger

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Terraform and OpenTofu changes fail in predictable but costly ways: resource addresses churn after refactors, secrets leak into state files, CI plans diverge from local plans, and targeted destroys cascade beyond intent. This Skill diagnoses the failure mode first, then applies version-aware fixes with explicit validation and rollback plans instead of generating untested HCL. ## Core Features & Use Cases - Diagnose-first routing: Maps symptoms to failure categories (identity churn, secret exposure, blast radius, CI drift, state corruption, testing blind spots) and loads only the matching reference depth. - Version-guarded code generation: Verifies the runtime floor before emitting features like moved blocks, write_only arguments, mock providers, or S3 native locking, with explicit pre-floor fallbacks. - Safe operations contract: Enforces reviewed plan artifacts before apply, plan -destroy before any destroy, and rollback notes for state-mutating changes. - Use Case: A team refactors subnets from count to for_each and resources start recreating. The Skill identifies identity churn, generates moved blocks for each address, and requires a plan showing zero destroy before apply. ## Quick Start Ask the assistant to review your Terraform module for state and security risks, for example: diagnose why my plan wants to recreate all subnets after I reordered the availability zones list and propose a safe fix.

Frequently Asked Questions about terraform-skill

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

FAQPage Schema
How do I migrate Terraform resources from count to for_each without recreating them?▼

Add for_each with stable keys, then write a moved block mapping each old index address to its new key address, such as aws_subnet.private[0] to aws_subnet.private["us-east-1a"]. Run terraform plan and confirm it shows move operations with zero destroy before applying.

How do I keep secrets out of the Terraform state file?▼

Marking a variable sensitive only masks display; the value still lands in state. On Terraform 1.11+ use write_only arguments like password_wo, on 1.10+ use ephemeral values, or source secrets from a manager like AWS Secrets Manager at runtime.

Does this guidance work with OpenTofu as well as Terraform?▼

Yes, both runtimes are supported since HCL is identical between them. OpenTofu starts at version 1.6, so native test and mock provider features apply there, and the Skill asks which runtime you use before generating commands or CI configuration.

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 have the apply stage consume the reviewed plan artifact from the plan stage.

When should I use count versus for_each in Terraform?▼

Use count only for optional singletons (condition ? 1 : 0) or when keys cannot be known at plan time. Use for_each with stable keys whenever collection identity matters, because removing a middle list element under count reshuffles every subsequent resource address.

How do I safely destroy Terraform resources without deleting dependents?▼

Always run terraform plan -destroy first and review every resource listed, including implicit dependents pulled in through locals or for_each references. Never use -auto-approve on destroy, and get explicit confirmation of the full deletion list before applying.