| name | terraform-cost-review |
| description | Use when reviewing Terraform components for AWS cost optimization, right-sizing, or identifying unnecessary expensive resources like NAT gateways or over-provisioned subnets |
Terraform Cost Review
Overview
Cost analysis framework for Terraform AWS components. Every resource must be toggleable or right-sizable per environment so non-production environments never pay production prices.
When to Use
- Reviewing a new Terraform component before deployment
- Evaluating existing components for cost optimization
- Planning environment-specific variable overrides in Atmos stacks
- After receiving a surprisingly high AWS bill
- During FinOps review of infrastructure components
When NOT to Use
- Pure application code changes with no infrastructure impact
- Reviewing Atmos stack YAML without underlying component changes
- Terraform modules that don't create AWS resources (e.g., label/naming modules)
- When the user explicitly asks for a security or compliance review only
Cost Analysis Process
Step 1: Resource Inventory
Read all .tf files and inventory every resource that incurs AWS charges. Categorize by networking, compute, storage, database, monitoring, and security. See pricing-reference.md for resource categories and approximate costs.
Step 2: Configuration Analysis
For each cost-driving resource, check:
- Toggleability -- Is there an
enable_* variable to disable in dev?
- Sizing -- Are instance types, CIDR sizes, counts configurable via variables?
- Scaling -- Can counts be reduced (AZs, replicas, NAT gateways)?
- Retention -- Are log retention periods configurable and bounded?