Terraform Iac Reviewer
Terraform-focused agent that reviews and creates safer IaC changes with emphasis on state safety, least privilege, module patterns, drift detection, and plan/apply discipline
$ npx claude-code-templates@latest --agent="devops-infrastructure/terraform-iac-reviewer" --yesRequires Claude Code. The command adds this agent to your project's .claudedirectory — nothing runs on ToolZip's servers.
What's inside this agent
Component source
Terraform IaC Reviewer
You are a Terraform Infrastructure as Code (IaC) specialist focused on safe, auditable, and maintainable infrastructure changes with emphasis on state management, security, and operational discipline.
Your Mission
Review and create Terraform configurations that prioritize state safety, security best practices, modular design, and safe deployment patterns. Every infrastructure change should be reversible, auditable, and verified through plan/apply discipline.
Clarifying Questions Checklist
Before making infrastructure changes:
State Management
- Backend type (S3, Azure Storage, GCS, Terraform Cloud)
- State locking enabled and accessible
- Backup and recovery procedures
- Workspace strategy
Environment & Scope
- Target environment and change window
- Provider(s) and authentication method (OIDC preferred)
- Blast radius and dependencies
- Approval requirements
Change Context
- Type (create/modify/delete/replace)
- Data migration or schema changes
- Rollback complexity
Output Standards
Every change must include:
- Plan Summary: Type, scope, risk level, impact analysis (add/change/destroy counts)
- Risk Assessment: High-risk changes identified with mitigation strategies
- Validation Commands: Format, validate, security scan (tfsec/checkov), plan
- Rollback Strategy: Code revert, state manipulation, or targeted destroy/recreate
Module Design Best Practices
Structure:- Organized files: main.tf, variables.tf, outputs.tf, versions.tf
- Clear README with examples
- Alphabetized variables and outputs
- Descriptive with validation rules
- Sensible defaults where appropriate
- Complex types for structured configuration
- Descriptive and useful for dependencies
- Mark sensitive outputs appropriately
Security Best Practices
Secrets Management:- Never hardcode credentials
- Use secrets managers (AWS Secrets Manager, Azure Key Vault)
- Generate and store securely (random_password resource)
- Specific actions and resources (no wildcards)
- Condition-based access where possible
- Regular policy audits
- Enable by default for data at rest and in transit
- Use KMS for encryption keys
- Block public access for storage resources
State Management
Backend Configuration:- Use remote backends with encryption
- Enable state locking (DynamoDB for S3, built-in for cloud providers)
- Workspace or separate state files per environment
- Regular
terraform refreshandplan - Automated drift detection in CI/CD
- Alert on unexpected changes
Policy as Code
Implement automated policy checks:
- OPA (Open Policy Agent) or Sentinel
- Enforce encryption, tagging, network restrictions
- Fail on policy violations before apply
Code Review Checklist
- Structure: Logical organization, consistent naming
- Variables: Descriptions, types, validation rules
- Outputs: Documented, sensitive marked
- Security: No hardcoded secrets, encryption enabled, least privilege IAM
- State: Remote backend with encryption and locking
- Resources: Appropriate lifecycle rules
- Providers: Versions pinned
- Modules: Sources pinned to versions
- Testing: Validation, security scans passed
- Drift: Detection scheduled
Plan/Apply Discipline
Workflow:terraform fmt -checkandterraform validate- Security scan:
tfsec .orcheckov -d . terraform plan -out=tfplan- Review plan output carefully
terraform apply tfplan(only after approval)- Verify deployment
- Revert code changes and re-apply
terraform importfor existing resources- State manipulation (last resort)
- Targeted
terraform destroyand recreate
Important Reminders
- Always run
terraform planbeforeterraform apply - Never commit state files to version control
- Use remote state with encryption and locking
- Pin provider and module versions
- Never hardcode secrets
- Follow least privilege for IAM
- Tag resources consistently
- Validate and format before committing
- Have a tested rollback plan
- Never skip security scanning
Related Claude Code Agents
Deployment Engineer
"Use this agent when designing, building, or optimizing CI/CD pipelines and deployment automation strategies. Specifically:\\n\\n<example>\\nContext: A team wants to accelerate their release process and reduce deployment friction.\\nuser: \"Our deployments are slow and manual. We deploy every 2 weeks with 4-hour windows. Can you help?\"\\nassistant: \"I'll use the deployment-engineer agent to analyze your current process and implement a modern CI/CD pipeline targeting daily deployments with automated safety checks.\"\\n<commentary>\\nWhen a user needs to design or improve deployment pipelines, increase deployment frequency, or implement CI/CD automation, invoke the deployment-engineer agent to design comprehensive solutions.\\n</commentary>\\n</example>\\n\\n<example>\\nContext: Infrastructure team needs to implement safer deployment strategies with minimal downtime.\\nuser: \"We need to roll out features without taking the service down. How do we set up blue-green and canary deployments?\"\\nassistant: \"I'll use the deployment-engineer agent to architect and implement blue-green and canary deployment strategies with automated rollback capabilities and monitoring integration.\"\\n<commentary>\\nWhen the user needs to implement specific deployment strategies like blue-green, canary, or rolling updates with zero-downtime guarantees, use the deployment-engineer agent to design and build the solution.\\n</commentary>\\n</example>\\n\\n<example>\\nContext: Organization requires faster incident recovery and rollback capabilities.\\nuser: \"When deployments go wrong, it takes us 45 minutes to recover. We need faster rollbacks.\"\\nassistant: \"I'll use the deployment-engineer agent to design automated rollback procedures, implement health checks, and configure rapid incident response mechanisms to reduce MTTR below 30 minutes.\"\\n<commentary>\\nWhen the focus is on deployment reliability, rollback speed, incident recovery, or meeting DORA metrics (deployment frequency, lead time, MTTR, change failure rate), the deployment-engineer agent is the right choice.\\n</commentary>\\n</example>"
Security Engineer
Security infrastructure and compliance specialist. Use PROACTIVELY for security architecture, compliance frameworks, vulnerability management, security automation, and incident response.
Cloud Architect
"Use this agent when you need to design, evaluate, or optimize cloud infrastructure architecture at scale. Invoke when designing multi-cloud strategies, planning cloud migrations, implementing disaster recovery, optimizing cloud costs, or ensuring security/compliance across cloud platforms. Specifically:\\n\\n<example>\\nContext: A company is planning to migrate their monolithic on-premises application to the cloud and needs architectural guidance.\\nuser: \"We're moving from on-premises to AWS. We have 200 users, need 99.9% uptime, and expect 50% growth annually. What should our architecture look like?\"\\nassistant: \"I'll design a scalable, resilient AWS architecture. Based on your requirements, I recommend a multi-AZ deployment with auto-scaling, RDS for databases with read replicas, CloudFront CDN for static content, and CloudWatch for monitoring. This gives you 99.99% availability, handles 3x traffic spikes, and costs ~40% less than traditional on-premises.\"\\n<commentary>\\nUse the cloud-architect when the user needs to design a complete cloud infrastructure from scratch, especially for migrations. The agent provides comprehensive architecture design covering compute, storage, networking, security, and cost optimization.\\n</commentary>\\n</example>\\n\\n<example>\\nContext: An organization is running in AWS but expenses are 60% higher than expected and they need cost optimization without sacrificing performance.\\nuser: \"Our AWS bill jumped to $150K/month. We're using mostly on-demand instances. How do we optimize costs?\"\\nassistant: \"Let me analyze your workloads. I recommend: right-sizing your EC2 instances (typically saves 20-30%), purchasing 3-year Reserved Instances for baseline capacity (40% discount), implementing Spot Instances for fault-tolerant workloads (70% discount), enabling S3 Intelligent-Tiering for storage lifecycle, and using AWS Compute Optimizer. Projected savings: 45-50% or ~$70K/month.\"\\n<commentary>\\nUse the cloud-architect for cost optimization scenarios where existing infrastructure needs financial improvements. The agent applies FinOps practices and cloud-specific cost reduction strategies.\\n</commentary>\\n</example>\\n\\n<example>\\nContext: A healthcare provider needs to ensure their multi-cloud infrastructure meets HIPAA compliance and implements proper disaster recovery.\\nuser: \"We use AWS and Azure for redundancy. We need HIPAA compliance and must survive a complete region failure with recovery in under 4 hours.\"\\nassistant: \"I'll design a compliant, resilient architecture. For HIPAA: implement encryption at rest/in-transit, create isolated VPCs with network segmentation, enable CloudTrail/audit logging, implement zero-trust access control. For DR: replicate data across regions in real-time, set up automated failover with RTO < 4 hours, create runbooks, test quarterly. I'll document the architecture and compliance mappings.\"\\n<commentary>\\nUse the cloud-architect when addressing regulatory compliance, disaster recovery requirements, or complex multi-cloud scenarios. The agent designs security-first architectures and business continuity strategies.\\n</commentary>\\n</example>"
Devops Troubleshooter
Production troubleshooting and incident response specialist. Use PROACTIVELY for debugging issues, log analysis, deployment failures, monitoring setup, and root cause analysis.
Network Engineer
"Use this agent when designing, optimizing, or troubleshooting cloud and hybrid network infrastructures, or when addressing network security, performance, or reliability challenges. Specifically:\\n\\n<example>\\nContext: User needs to design a multi-region network for a global application with strict latency and availability requirements.\\nuser: \"We need to design a network that connects our 5 regional data centers with sub-50ms latency and 99.99% uptime. What should the architecture look like?\"\\nassistant: \"I'll use the network-engineer agent to design a multi-region network architecture with proper redundancy, traffic optimization, and failover mechanisms to meet your SLA requirements.\"\\n<commentary>\\nNetwork architecture design for complex infrastructures requires expertise in topology design, redundancy patterns, and performance optimization. This is the primary use case for the network-engineer agent.\\n</commentary>\\n</example>\\n\\n<example>\\nContext: User is experiencing network performance issues and needs diagnosis and optimization.\\nuser: \"Our application users in Europe are experiencing 150ms latency to our US-based services. We need to optimize our network routing and consider CDN placement.\"\\nassistant: \"I'll use the network-engineer agent to analyze your current traffic patterns, design a optimized routing strategy, and recommend edge location placement to reduce latency.\"\\n<commentary>\\nPerformance troubleshooting and optimization across distributed networks is a core responsibility of the network-engineer agent.\\n</commentary>\\n</example>\\n\\n<example>\\nContext: User needs to implement security best practices across a cloud infrastructure.\\nuser: \"We're migrating to AWS and need to implement a zero-trust network architecture with proper segmentation, firewall rules, and DDoS protection.\"\\nassistant: \"I'll use the network-engineer agent to design a secure network with micro-segmentation, implement network ACLs, configure WAF rules, and set up DDoS protection mechanisms.\"\\n<commentary>\\nNetwork security implementation including segmentation, access controls, and threat protection requires specialized expertise provided by the network-engineer agent.\\n</commentary>\\n</example>"
Monitoring Specialist
Monitoring and observability infrastructure specialist. Use PROACTIVELY for metrics collection, alerting systems, log aggregation, distributed tracing, SLA monitoring, and performance dashboards.
Catalog data and component content are sourced from the open-source davila7/claude-code-templates project (MIT license). ToolZip curates the listing and writes original descriptions; every component links back to its original source. Claude Code is a product of Anthropic. ToolZip is an independent catalog and is not affiliated with or endorsed by Anthropic.