Every Terraform user hits the same problem within weeks of starting: the configuration works for one environment, and now there are three. Development, staging and production need the same infrastructure in different sizes, with different values, and β critically β with different state, so that destroying development never touches production. Terraform workspaces are the built-in answer to that problem, and they are also one of the most misunderstood features in Terraform. They are not environments. They are not folders. They are not a deployment strategy. They are a way of keeping several state files behind a single configuration, and understanding exactly what that means is the difference between using them well and using them to build a system nobody can reason about.
This guide explains workspaces as they stand in Terraform 1.17.2, the current release as of 30 November 2026: what a workspace actually is, the commands that manage them, how to use the workspace name inside your configuration, how theyβ¦