Creating Workspaces
Explore how Terraform workspaces allow you to manage multiple deployment environments by creating isolated state files. Understand workspace commands and how to create and switch workspaces to maintain consistent infrastructure configurations.
What is a workspace in Terraform?
A workspace in Terraform Cloud and Terraform open-source mean two slightly different things. For the certification, we’re focusing on the Terraform open-source option. Workspaces in Terraform open-source are independently managed state files that share a common configuration.
Note: In older versions of Terraform, a similar construct called an environment was managed using the
terraform envcommand. That command still exists, but it’s essentially an alias forterraform workspaceand may be deprecated in a future release.
Workspace for multiple environments
Many organizations have multiple environments, including development, testing, staging, and production. Each Terraform workspace is meant to represent the deployment of a ...