Terraform Workspaces vs Directories#
You have dev, staging, and production. Same infrastructure, different sizes and settings. How do you organize Terraform? Two competing approaches:
- Workspaces: One set of
.tffiles, multiple state files selected byterraform workspace select - Directories: Separate directories per environment, each with their own
.tffiles and state
Both work. Both have tradeoffs. The right choice depends on how similar your environments are, who manages them, and how much isolation you need.