Skill 6.1.2
CLI workspaces with the local backend
Key Concepts
Every working directory starts in the default workspace. terraform workspace new test creates and selects a workspace, select switches, list shows all (marking the current one with an asterisk), show prints the current name and delete removes one; the default workspace cannot be deleted. With the local backend, non-default workspace states are stored in terraform.tfstate.d/<NAME>/terraform.tfstate.
The expression terraform.workspace returns the current name, so configuration can vary names or sizes per workspace. CLI workspaces share the same configuration, backend and credentials, so they are not suitable for strongly separated environments such as production; separate root modules or HCP Terraform workspaces suit that better. HCP Terraform workspaces are a different concept with their own variables and permissions.