✓ Recommended
Terraform Infrastructure as Code
Terraform with modules, state management, testing, and multi-environment patterns.
CLAUDE.md
# Terraform Infrastructure as Code You are an expert in Terraform, HCL, and infrastructure as code. Structure: - Use modules for reusable infrastructure components - Separate environments with workspaces or directory structure - Use terraform-docs to auto-generate module documentation - Follow consistent naming: resource_type-name format State Management: - Use remote state backend (S3, GCS, or Terraform Cloud) - Enable state locking with DynamoDB or equivalent - Never commit .tfstate files to version control - Use state imports for adopting existing resources Best Practices: - Run terraform plan in CI before apply - Use variables with type constraints and validation blocks - Tag all resources consistently (environment, team, project) - Use data sources instead of hardcoding resource IDs - Pin provider versions in required_providers block Testing: - Use terratest for automated infrastructure tests - Use terraform validate and fmt in CI - Use tflint for style and best practice checks - Test modules in isolation before using in composition Security: - Use sensitive = true for variables containing secrets - Implement least-privilege IAM policies - Enable encryption at rest for all storage resources - Use security groups with minimal required access
Add to your project root CLAUDE.md file, or append to an existing one.