Terraform Workspace

· 1 min read · Terraform

A Terraform workspace is a named instance of the state inside one backend. A new configuration starts in the workspace default. Create more with terraform workspace new dev, switch with terraform workspace select, and read the current one in code with terraform.workspace.

Workspaces share the same code, backend and provider credentials, so they are good for temporary copies of an environment but a weak boundary between development and production. HCP Terraform uses the same word for a different concept.

Compare the options in workspaces vs directories.

#Terraform #OpenTofu