
Terraform Module Architect
Design production-grade Terraform modules with safe refactoring strategies
What You Can Do
This skill audits your existing Terraform infrastructure, designs production-ready module structures, and creates detailed migration plans with safety checkpoints. You get comprehensive refactoring guidance, dependency analysis, test strategies, and step-by-step migration playbooks that minimize production risk.
Features
Assess current Terraform structure and design modular, reusable, production-grade architecture patterns
Break down monolithic Terraform into composable, maintainable modules with clear boundaries
Create detailed, risk-assessed migration plans with pre-checks, validation gates, and rollback procedures
Map module dependencies, identify circular dependencies, and optimize the dependency tree for parallel execution
Design consistent variable schemas, output contracts, and public/internal interfaces for module consumers
Generate unit test plans, integration test strategies, and pre-production validation checklists
Produce module README templates, variable documentation, and usage examples for all modules
Validate modules against AWS/Azure/GCP best practices and organizational standards
Example Output
Architecture Review Output
Current State: Monolithic main.tf with 2,400 lines spanning VPC, Kubernetes, monitoring, and databases.
Proposed Module Structure:
modules/
network/ # VPC, subnets, routing, security groups
kubernetes/ # EKS cluster, node groups, add-ons
observability/ # CloudWatch, Prometheus, Grafana configs
databases/ # RDS, ElastiCache, backup policies
iam/ # Roles, policies, service accounts
Migration Plan:
- Extract IAM module (no infrastructure dependencies) — Phase 1, Week 1
- Extract Network module (depended on by K8s/RDS) — Phase 1, Week 2
- Extract Databases module (safe to run in parallel) — Phase 2, Week 1
- Migrate Kubernetes to new network module — Phase 2, Week 2
- Validate with
terraform planand smoke tests — Phase 3
Risk Assessment: Medium — Plan shows 45 resource additions, 12 resource deletions (safe via moved blocks), zero data loss expected.
What's Included
- SKILL.md: Core Terraform module architecture and refactoring workflow
- Module Design Template: Production-ready module structure checklist
- Migration Planning Worksheet: Step-by-step template for safe refactoring with validation gates
- Dependency Graph Analysis Template: Map and visualize Terraform module dependencies
- Safety Validation Checklist: Pre-migration and post-migration verification steps
- Test Strategy Workbook: Unit test patterns, integration test plans, and validation procedures
- Module Documentation Template: Consistent README, variable docs, and usage examples for all modules
- Terraform Best Practices Guide: Reference for variable naming, output design, and module composition patterns
Who It's For
- DevOps Engineers — Restructure legacy Terraform to scale with team and projects
- Infrastructure/Platform Engineers — Design modular, reusable infrastructure-as-code libraries
- Cloud Architects — Plan production-grade infrastructure refactoring with safety and minimal downtime
- Terraform Leads/Tech Leads — Establish module standards and migration governance for large teams
Best For
- Auditing and redesigning monolithic Terraform into modular architecture
- Planning safe migrations from flat infrastructure code to production modules
- Designing module contracts (variables, outputs, dependencies) for team consumption
- Creating risk assessments and migration playbooks with validation gates
- Documenting and standardizing Terraform module patterns across teams







