A developer wants to stand up a temporary, parallel copy of the team's staging infrastructure to test a feature branch, using the same configuration, backend and credentials, and to tear it down afterwards. Which approach does HashiCorp describe for this?
Choose one.
A CLI workspace is a separate state for the same configuration and backend, which makes it a cheap way to create a parallel copy of infrastructure.
HashiCorp's stated use case for multiple workspaces is creating a parallel, distinct copy of a set of infrastructure to test changes before touching the main deployment. A new workspace starts with empty state, so apply creates a second set of objects; destroy and workspace delete remove it. Copying state would bind the branch to the real staging objects, and -target still acts on staging itself.
- Note the need: a temporary copy, same configuration, backend and credentials.
- Recall that a new workspace has empty state, so apply creates new objects.
- Clean up with destroy, then delete the workspace.
Exam tip: Short-lived parallel copy of the same infrastructure: a CLI workspace.
Terraform Professional: Scaling Projects and Multiple Environments — the lesson that teaches this.