Overview
This example shows how to create multiple environments with different configurations using Terraform’sfor_each loop.
Configuration
Variables
Outputs
Deployment
Features
Environment-Specific Configuration
Environment-Specific Configuration
Each environment has tailored resource allocations:
- Development: Minimal resources (250 CPU, 256 MB RAM, 1 replica)
- Staging: Medium resources (500 CPU, 512 MB RAM, 2 replicas)
- Production: Full resources (1000 CPU, 1024 MB RAM, 3 replicas)
Branch Mapping
Branch Mapping
Environments deploy from different Git branches:
- Development →
developbranch - Staging →
stagingbranch - Production →
mainbranch
Auto-Deploy Settings
Auto-Deploy Settings
- Development and Staging: Auto-deploy enabled
- Production: Manual deployments only
Database Sizing
Database Sizing
- Development & Staging: 10 GB storage
- Production: 50 GB storage