Terraform
Terraform Workspace
Appears inTerraform Associate
Separate state instances within the same configuration. Lets you manage multiple environments (dev, staging, prod) with the same codebase. Each workspace has its own tfstate file.
On the exam
In Terraform Associate: terraform workspace new dev creates a workspace. The default workspace is called "default". It's an alternative to having separate directories per environment, though modules + directories are preferred for complex configurations.
Related terms
- Terraform StateA file (terraform.tfstate) that Terraform uses to map the real-world configuration in code to actual resources in the cloud. It's Terraform's source of truth about which resources it manages and their current status.
- Terraform BackendA configuration that defines where Terraform state is stored. Remote backends (S3, Azure Blob Storage, HCP Terraform) enable team collaboration and state locking to avoid conflicts.