TF-Associate-004 - HCP Terraform - Section 8c

Describe how to organize and use HCP Terraform workspaces and projects.

An HCP Terraform workspace has its own state, variables and run history, and projects group related workspaces for organisation and permissions. Candidates should distinguish an HCP Terraform workspace, which holds state, from a Terraform CLI workspace, which switches state within one backend.

HCP Terraform workspaceprojects grouping workspacesworkspace variables and run historyHCP workspace versus CLI workspace

Practice question for this objective

Free sampleHCP Terraformmedium

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.
An HCP Terraform workspace is the unit that isolates state, variables, and run history, so separate environments each need their own workspace. HCP Terraform models each workspace as an independent managed unit with its own state file, variable values, and history of runs, which is why isolating environments is achieved by creating one workspace per environment rather than by CLI workspaces or variable sets.

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.

See more TF-Associate-004 practice questions, answers explained.

More in this domain

Back to all HCP Terraform objectives, or the TF-Associate-004 cert hub.

Examworthy is not affiliated with or endorsed by HashiCorp. Original, blueprint-aligned practice material only.