terraform

poindexter12's avatarfrom poindexter12

Terraform infrastructure-as-code reference for HCL syntax, state management,module design, and provider configuration. Use when working with Terraformconfigurations (.tf files), running terraform commands, troubleshooting stateissues, or designing modules. Includes Telmate Proxmox provider patterns.Triggers: terraform, tfstate, .tf files, HCL, modules, providers, proxmox_vm_qemu.

⭐0stars🔀0forks📁View on GitHub🕐Updated Dec 13, 2025

When & Why to Use This Skill

This Claude skill serves as a comprehensive expert reference for Terraform and HashiCorp Configuration Language (HCL). It optimizes Infrastructure-as-Code (IaC) workflows by providing immediate guidance on syntax validation, state management, modular architecture design, and provider-specific configurations, including specialized patterns for Proxmox environments.

Use Cases

  • Case 1: Developing and validating HCL configurations for automated cloud resource provisioning and environment setup.
  • Case 2: Managing and troubleshooting Terraform state files, including handling backends, state locking, and resource inspection.
  • Case 3: Designing scalable, reusable infrastructure modules and implementing security best practices like sensitive variable handling.
  • Case 4: Debugging complex deployment issues and provider-specific errors, particularly for Telmate Proxmox and VM QEMU resources.
  • Case 5: Executing standard DevOps workflows (init, plan, apply) with a focus on syntax consistency and pre-deployment checklists.
nameterraform
description|
Triggersterraform, tfstate, .tf files, HCL, modules, providers, proxmox_vm_qemu.
agentterraform-expert

Terraform Skill

Infrastructure-as-code reference for Terraform configurations, state management, and provider patterns.

Quick Reference

# Core workflow
terraform init              # Initialize, download providers
terraform validate          # Syntax validation
terraform fmt -recursive    # Format HCL files
terraform plan              # Preview changes
terraform apply             # Apply changes

# Inspection
terraform state list                    # List resources in state
terraform state show <resource>         # Show resource details
terraform graph | dot -Tsvg > graph.svg # Dependency graph

# Debug
TF_LOG=DEBUG terraform plan 2>debug.log

Core Workflow

init → validate → fmt → plan → apply
  1. init: Download providers, initialize backend
  2. validate: Check syntax and configuration validity
  3. fmt: Ensure consistent formatting
  4. plan: Preview what will change (review carefully)
  5. apply: Execute changes

Reference Files

Load on-demand based on task:

Topic File When to Load
Troubleshooting troubleshooting.md Common errors, debugging
State state-management.md Backends, locking, operations
Modules module-design.md Module patterns, composition
Security security.md Secrets, state security
Proxmox Gotchas proxmox/gotchas.md Critical provider issues, workarounds
Proxmox Auth proxmox/authentication.md Provider config, API tokens
Proxmox VMs proxmox/vm-qemu.md proxmox_vm_qemu resource patterns
Proxmox Errors proxmox/troubleshooting.md Proxmox-specific errors
External external-resources.md Official docs, links

Validation Checklist

Before terraform apply:

  • terraform init completed successfully
  • terraform validate passes
  • terraform fmt applied
  • terraform plan reviewed (check destroy/replace operations)
  • Backend configured correctly (for team environments)
  • State locking enabled (if remote backend)
  • Sensitive variables marked sensitive = true
  • Provider versions pinned in terraform.tf
  • No secrets in version control
  • Blast radius assessed (what could break?)

Variable Precedence

(highest to lowest)

  1. -var flag: terraform apply -var="name=value"
  2. -var-file flag: terraform apply -var-file=prod.tfvars
  3. *.auto.tfvars files (alphabetically)
  4. terraform.tfvars file
  5. TF_VAR_* environment variables
  6. Variable defaults in variables.tf