Terraform workspace

A named, separate state within one backend, so the same configuration can manage several copies of its infrastructure.

In more detail

Every configuration starts in the workspace called default, and terraform.workspace returns the current name. Workspaces share the backend and its credentials, so HashiCorp recommends separate configurations, not workspaces, when environments need strong isolation such as production. Do not confuse them with the similarly named workspaces in HashiCorp's hosted service, which work differently.

Example

terraform workspace new staging
terraform workspace select staging

Related terms

Taught in

References

Certification courses