Terraform expert is an AI agent skill from the GitHub repository rnavarych/alpha-engineer. Terraform and Infrastructure as Code expertise covering HCL module design, state management, workspaces, provider configuration, drift detection, Terragrunt, infrastructure testing, and resource lifecycle management.
Claude Code: save it as .claude/skills/terraform-expert/SKILL.md
Cursor: save it as .cursor/rules/terraform-expert.md
Codex: save it as .agents/skills/terraform-expert/SKILL.md
ChatGPT, Gemini and other assistants: paste it into custom or project instructions
Skill file
Terraform Expert
When to use
Designing or reviewing Terraform module structure and composition
Configuring remote backends, state locking, or organizing state by environment
Setting up Terragrunt for DRY multi-environment configurations
Running infrastructure testing with Terratest, tflint, or Checkov/tfsec
Detecting and reconciling configuration drift
Implementing lifecycle rules for zero-downtime resource replacement
Core principles
Remote state always — never commit terraform.tfstate, always lock concurrent applies
Modules are versioned — Git tags or registry versions, never floating references
Plan before apply — saved plan artifact reviewed before production apply
Security scanning in CI — Checkov or tfsec fails the pipeline on critical findings
Drift is technical debt — scheduled plan runs detect and surface manual changes before they compound
Reference Files
references/modules-state-providers.md — HCL module structure (variables.tf/outputs.tf/main.tf), variable validation blocks, Git tag versioning, remote backends (S3+DynamoDB/GCS/Terraform Cloud), state locking, blast-radius state organization, workspace use cases, provider version pinning and aliases, drift detection with scheduled CI plans and Spacelift, Terragrunt DRY patterns with dependency blocks and generate blocks, sensitive variable handling
references/testing-lifecycle-patterns.md — CI pipeline stages (fmt/validate/tflint/checkov/plan/apply), Terratest Go integration test pattern with defer destroy, prevent_destroy and create_before_destroy lifecycle rules, ignore_changes for externally managed attributes, terraform import workflow, data sources for existing infrastructure, terraform output -json for downstream CI steps, best practices checklist
Best Practices Checklist
Remote backend with state locking enabled
Provider versions pinned in required_providers
Modules versioned with Git tags or registry versions
terraform plan runs on every pull request
Security scanning (tfsec/Checkov) in CI
Sensitive variables marked and protected
State organized by environment and component
Resources tagged consistently for cost tracking
prevent_destroy set on stateful production resources
Terratest or equivalent for module integration tests
Use this skill with your AI agent:Open on Skill Issue to copy, download, or add to your library.
Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.