A team has one HCP Terraform organisation and wants each of its three environments (dev, staging, production) to keep completely separate state, variable values, and run history, while still being managed through the same VCS-connected setup. How should they structure this in HCP Terraform?
- ACreate a single HCP Terraform workspace and switch between the environments using 'terraform workspace new' and 'terraform workspace select' on the CLI.
- BCreate three separate HCP Terraform workspaces, one per environment, so each holds its own state, variables, and run history. Correct
- CCreate one HCP Terraform workspace and define three variable sets inside it so the same state is reused across dev, staging, and production.
- DCreate one HCP Terraform project and rely on the project to hold three independent states, one for each environment, without adding workspaces.
Why A is wrong: This describes Terraform CLI workspaces, which only switch the state key inside one backend and share the same configuration and run context; it is a different feature from an HCP Terraform workspace and does not give separate run history or variable sets per environment.
Why B is correct: In HCP Terraform the workspace is the unit of isolation: each workspace stores its own state, its own variables, and its own run history, so one workspace per environment gives the separation the team wants.
Why C is wrong: Variable sets can supply different values, but a single workspace still keeps just one state and one run history, so the environments would not be isolated as required.
Why D is wrong: A project is only a grouping container for workspaces and holds no state of its own, so a project without workspaces cannot store any environment state.