Terraform Workspaces vs Directories: Choosing an Environment Isolation Strategy

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 .tf files, multiple state files selected by terraform workspace select
  • Directories: Separate directories per environment, each with their own .tf files 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.