Awesome-omni-skill terraform-infra

Terraform infrastructure operations with safety controls

install
source · Clone the upstream repo
git clone https://github.com/diegosouzapw/awesome-omni-skill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/devops/terraform-infra" ~/.claude/skills/diegosouzapw-awesome-omni-skill-terraform-infra && rm -rf "$T"
manifest: skills/devops/terraform-infra/SKILL.md
source content

Terraform Infrastructure Skill

Installation

The skill invokes the Terraform CLI. Install:

  • macOS:
    brew tap hashicorp/tap && brew install hashicorp/tap/terraform
  • Windows:
    choco install terraform
    or download from HashiCorp
  • Linux (apt): Add HashiCorp repo then
    sudo apt update && sudo apt install terraform
    (see HashiCorp install)

Verify:

terraform --version

Cheat Sheet & Best Practices

Workflow:

terraform init
terraform fmt
terraform validate
terraform plan -out=tfplan
→ review →
terraform apply tfplan
. Use
terraform show tfplan
to inspect.

Hacks: Always run

plan
before
apply
; never
apply
blind. Use remote state (e.g. S3 + lock) for team work. Prefer
-auto-approve
only in CI with reviewed plans. Use
terraform state list
and
terraform state show <resource>
to debug. Use service accounts / workload identity in pipelines; avoid static keys.

Certifications & Training

HashiCorp Terraform Associate (004): IaC concepts, Terraform fundamentals, state, modules, Terraform Cloud. Learning path. Skill data: init → fmt → validate → plan -out → apply; remote state; no blind apply.

Hooks & Workflows

Suggested hooks: Pre-apply: run

terraform plan -out=tfplan
and gate on review. CI: apply only after plan approval. Use with devops (primary).

Workflows: Use with devops (primary). Flow: init → plan → review → apply; use state commands for debugging. See

ci-cd-implementation-rule
for pipeline integration.

Overview

Provides 90%+ context savings vs raw Terraform MCP server. Includes critical safety controls for infrastructure operations.

Requirements

  • Terraform CLI (v1.0+)
  • Cloud provider credentials configured
  • Working directory with .tf files

Tools (Progressive Disclosure)

Planning & Validation

ToolDescriptionConfirmation
planGenerate terraform planNo
validateValidate configurationNo
fmtFormat terraform filesNo

State Operations

ToolDescriptionConfirmation
showDisplay current stateNo
listList state resourcesNo
state-mvMove resource in stateYes

Workspace Operations

ToolDescriptionConfirmation
workspace-listList workspacesNo
workspace-selectSelect workspaceNo
workspace-newCreate workspaceYes

Execution (⚠️ Dangerous)

ToolDescriptionConfirmation
applyApply changesREQUIRED

Blocked Operations

ToolStatus
destroyBLOCKED
state-rmBLOCKED

Quick Reference

# Initialize
terraform init

# Plan changes
terraform plan -out=tfplan

# Validate
terraform validate

# Apply (requires -auto-approve for automation)
terraform apply tfplan

Configuration

  • Working directory: Must contain terraform files
  • TFVAR*: Variable values via environment
  • TF_WORKSPACE: Active workspace

Safety Controls

⚠️ terraform apply ALWAYS requires confirmation ⚠️ terraform destroy is BLOCKED by default ⚠️ State modifications require confirmation ⚠️ Review plan output before apply

Agent Integration

  • devops (primary): Infrastructure management
  • architect (secondary): Infrastructure design
  • cloud-integrator (secondary): Cloud provisioning

Troubleshooting

IssueSolution
Init failedCheck provider credentials
State lockedCheck for other operations
Plan failedReview error output carefully

Iron Laws

  1. ALWAYS run
    terraform plan
    and review the output before executing
    terraform apply
  2. NEVER hardcode credentials or secrets in
    .tf
    files — use secret managers (AWS Secrets Manager, Azure Key Vault, HashiCorp Vault)
  3. ALWAYS use remote state with encryption and state locking to prevent concurrent modifications
  4. NEVER edit state files directly — use
    terraform state
    commands exclusively
  5. ALWAYS pin provider and module versions for fully reproducible infrastructure deployments

Anti-Patterns

Anti-PatternWhy It FailsCorrect Approach
Hardcoded credentials in .tf filesSecret exposure in VCS, compliance failureUse variables with secret manager backend
No state lockingConcurrent applies corrupt stateEnable backend locking (S3+DynamoDB, Azure Blob, GCS)
terraform apply
without plan review
Unexpected resource deletion or recreationAlways
plan
first, review diff, then
apply
Unversioned providers and modulesNon-reproducible builds and breaking changesPin versions:
version = "~> 4.0"
Untagged resourcesUntrackable costs and compliance failureTag all resources with env, owner, cost-center

Memory Protocol (MANDATORY)

Before starting: Read

.claude/context/memory/learnings.md

After completing:

  • New pattern ->
    .claude/context/memory/learnings.md
  • Issue found ->
    .claude/context/memory/issues.md
  • Decision made ->
    .claude/context/memory/decisions.md

ASSUME INTERRUPTION: If it's not in memory, it didn't happen.