terraform-patterns
What it does
This skill helps write and review Terraform code, which defines cloud infrastructure in files. It is for engineers who manage infrastructure and want safer, cleaner configuration.
When to use it
- βWhen you are reviewing Terraform files for mistakes or bad structure.
- βWhen you are designing a reusable Terraform module.
- βWhen you want a security review of infrastructure code before changes.
Skill link
https://github.com/alirezarezvani/claude-skills/blob/main/engineering/terraform-patterns/skills/terraform-patterns/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βReview my Terraform files for security problems and bad patterns before I apply them.β
5 new skills a week. 1 minute to read.
How it works
It analyzes module structure and scans the configuration for misconfigurations and exposed secrets, then suggests fixes.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Terraform Patterns
Predictable infrastructure. Secure state. Modules that compose. No drift.
Opinionated Terraform workflow that turns sprawling HCL into well-structured, secure, production-grade infrastructure code. Covers module design, state management, provider patterns, security hardening, and CI/CD integration.
Not a Terraform tutorial β a set of concrete decisions about how to write infrastructure code that doesn't break at 3 AM.
Slash Commands
| Command | What it does |
|---|---|
/terraform-patterns review |
Analyze Terraform code for anti-patterns, security issues, and structure problems |
/terraform-patterns module |
Design or refactor a Terraform module with proper inputs, outputs, and composition |
/terraform-patterns security |
Audit Terraform code for security vulnerabilities, secrets exposure, and IAM misconfigurations |
When This Skill Activates
Recognize these patterns from the user:
- "Review this Terraform code"
- "Design a Terraform module for..."
- "My Terraform state is..."
- "Set up remote state backend"
- "Multi-region Terraform deployment"
- "Terraform security review"
- "Module structure best practices"
- "Terraform CI/CD pipeline"
- Any request involving:
.tffiles, HCL, Terraform modules, state management, provider configuration, infrastructure-as-code
If the user has .tf files or wants to provision infrastructure with Terraform β this skill applies.
Workflow
/terraform-patterns review β Terraform Code Review
Analyze current state
- Read all
.tffiles in the target directory - Identify module structure (flat vs nested)
- Count resources, data sources, variables, outputs
- Check naming conventions
- Read all
Apply review checklist
MODULE STRUCTURE βββ Variables have descriptions and type constraints βββ Outputs expose only what consumers need βββ Resources use consistent naming: {provider}_{type}_{purpose} βββ Locals used for computed values and DRY expressions βββ No hardcoded values β everything parameterized or in locals STATE & BACKEND βββ Remote backend configured (S3, GCS, Azure Blob, Terraform Cloud) βββ State locking enabled (DynamoDB for S3, native for others) βββ State encryption at rest enabled βββ No secrets stored in state (or state access is restricted) βββ Workspaces or directory isolation for environments PROVIDERS βββ Version constraints use pessimistic operator: ~> 5.0 βββ Required providers block in terraform {} block βββ Provider aliases for multi-region or multi-account βββ No provider configuration in child modules SECURITY βββ No hardcoded secrets, keys, or passwords βββ IAM follows least-privilege principle βββ Encryption enabled for storage, databases, secrets βββ Security groups are not overly permissive (no 0.0.0.0/0 ingress on sensitive ports) βββ Sensitive variables marked with sensitive = trueGenerate report
python3 scripts/tf_module_analyzer.py ./terraformRun security scan
python3 scripts/tf_security_scanner.py ./terraform
/terraform-patterns module β Module Design
Identify module scope
- Single responsibility: one module = one logical grouping
- Determine inputs (variables), outputs, and resource boundaries
- Decide: flat module (single directory) vs nested (calling child modules)
Apply module design checklist
STRUCTURE βββ main.tf β Primary resources βββ variables.tf β All input variables with descriptions and types βββ outputs.tf β All outputs with descriptions βββ versions.tf β terraform {} block with required_providers βββ locals.tf β Computed values and naming conventions βββ data.tf β Data sources (if any) βββ README.md β Usage examples and variable documentation VARIABLES βββ Every variable has: description, type, validation (where applicable) βββ Sensitive values marked: sensitive = true βββ Defaults provided for optional settings βββ Use object types for related settings: variable "config" { type = object({...}) } βββ Validate with: validation { condition = ... } OUTPUTS βββ Output IDs, ARNs, endpoints β things consumers need βββ Include description on every output βββ Mark sensitive outputs: sensitive = true βββ Don't output entire resources β only specific attributes COMPOSITI
FAQ
Does it cover remote state?
Yes, it includes setting up a remote state backend.
Does it run terraform apply for me?
No, it reviews and suggests changes; you run your own deploy steps.
Which clouds does it cover?
It covers general Terraform patterns, including provider setup, IAM and multi-region setups.
Details
Original description by the author
Use for any Terraform module, state backend, provider setup or IaC security review, before editing .tf files. Analyzes modules with tf_module_analyzer.py and scans for misconfigurations with tf_security_scanner.py.
Popularity
- GitHub stars
- 29k
- Ranking position
- #9612
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
agent-launcher-orchestrator
29kHelps your agent plan, build, test and schedule a Claude managed agent in your own account, step by step, starting from one clear goal.
grade-iterate
29kLets your agent grade a managed AI agent's work against a rubric and improve it in a fixed number of rounds, so it never loops forever.
interview
29kLets your agent interview you about an AI agent idea and turn your answers into a simple build plan before anything is launched.
run-without-you
29kHelps your agent set up a managed AI agent to run on a schedule or when an event happens, with the cron timing checked before launch.
Similar skills
openclaw-update
394kHelps your agent update an existing OpenClaw Gateway, choosing the update method that fits how it was installed and keeping your session working.
diagnose-gateway
394kHelps your agent find out why your OpenClaw Gateway is failing by checking settings, channels, and ports without changing anything.
crabbox-apps
394kHelps your agent open and run an app on a temporary cloud machine, then show its view in your chat side panel.