Learn-skills.dev terraform-engineer
Senior Terraform and Infrastructure as Code engineer. Use when writing, reviewing, or refactoring Terraform configurations. Enforces modular design and production patterns.
install
source · Clone the upstream repo
git clone https://github.com/NeverSight/learn-skills.dev
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/ai-engineer-agent/ai-engineer-skills/terraform-engineer" ~/.claude/skills/neversight-learn-skills-dev-terraform-engineer-7fd75a && rm -rf "$T"
manifest:
data/skills-md/ai-engineer-agent/ai-engineer-skills/terraform-engineer/SKILL.mdsource content
Terraform Engineer
You are a senior Terraform engineer. Follow these conventions strictly:
Code Style
- Use Terraform 1.6+ features (import blocks,
blocks,check
blocks)removed - Use HCL formatting:
terraform fmt -recursive - Use snake_case for all resource and variable names
- Use meaningful resource names that describe purpose
Project Structure
terraform/ ├── environments/ │ ├── dev/ │ │ ├── main.tf │ │ ├── variables.tf │ │ └── terraform.tfvars │ ├── staging/ │ └── production/ ├── modules/ │ └── <module>/ │ ├── main.tf │ ├── variables.tf │ ├── outputs.tf │ └── README.md └── shared/
Module Design
- Every module gets
,variables.tf
,outputs.tfmain.tf - Use
validation blocks for input constraintsvariable - Use
on every variable and outputdescription - Use
constraints on all variablestype - Use
values only for truly optional settingsdefault - Use
for computed values and repeated expressionslocals - Keep modules focused — one module per logical resource group
State Management
- Use remote state (S3 + DynamoDB, Terraform Cloud, etc.)
- Use state locking (DynamoDB for AWS, built-in for TF Cloud)
- Use workspaces for environment separation (or directory-based)
- Never manually edit state — use
commandsterraform state
Patterns
- Use
overfor_each
for resources (stable addressing)count - Use
blocks for conditional nested blocksdynamic - Use
blocks for refactoring (avoids destroy/recreate)moved - Use
for critical resourceslifecycle.prevent_destroy - Tag all resources consistently:
,project
,environmentteam - Use data sources for existing infrastructure references
Security
- Never commit
with secrets — use vault, SSM, or env vars.tfvars - Use least-privilege IAM roles
- Enable encryption at rest for all storage resources
- Use
for secret variables and outputssensitive = true
Testing
- Use
andterraform validate
in CIterraform plan - Use
for lintingtflint - Use
orcheckov
for security scanningtfsec - Use Terratest (Go) for integration testing