Task 8.3: Describe how to organize and use HCP Terraform workspaces and projects
Projects that group workspaces, permissions at the project level, variable sets shared across workspaces, run triggers between workspaces, and how HCP Terraform workspaces differ from CLI workspaces.
Study it
Workspaces and projects: variable sets, run triggers and access
Lesson coming
Sample questions
Try each one before opening the answer. Every option is explained, with the HashiCorp documentation page that proves it.
Question 1 · choose 1
The payments team owns twelve workspaces and will create more. The organization wants the team to get the same access to all of them, including future ones, without granting access workspace by workspace. What fits?
AGive the team organization owner permissions so that it can reach every workspace
BTag each workspace with payments, which grants the team access automatically
CCreate one variable set per workspace that lists the team's members
DGroup them in a project and grant the team access there
Show the answer and why
AGive the team organization owner permissions so that it can reach every workspace
Incorrect
That grants far more than access to twelve workspaces.
BTag each workspace with payments, which grants the team access automatically
Incorrect
Tags help select workspaces; they do not grant permissions.
CCreate one variable set per workspace that lists the team's members
Incorrect
Membership lists in variables do not grant access.
DGroup them in a project and grant the team access there
Correct
Projects group workspaces, and each project has a permission set that grants teams access to all workspaces in it.
Projects are the access boundary for groups of workspaces.
A team used CLI workspaces named dev and prod for one configuration and is moving to HCP Terraform. How do HCP Terraform workspaces differ from CLI workspaces?
AHCP workspaces are only a new name for CLI workspaces and behave in exactly the same way
BHCP workspaces cannot hold state; state stays in the CLI workspaces
CHCP workspaces must all share one configuration, like CLI workspaces
DHCP workspaces can be independent configurations with unique names
Show the answer and why
AHCP workspaces are only a new name for CLI workspaces and behave in exactly the same way
Incorrect
HCP workspaces carry their own variables, settings, permissions and run history.
BHCP workspaces cannot hold state; state stays in the CLI workspaces
Incorrect
HCP workspaces store the state.
CHCP workspaces must all share one configuration, like CLI workspaces
Incorrect
Each HCP workspace can be linked to its own configuration.
DHCP workspaces can be independent configurations with unique names
Correct
CLI workspaces are multiple states of one configuration; HCP Terraform workspaces can represent completely independent configurations and must have unique names.
In HCP Terraform, a workspace is a unit of configuration, state, variables and permissions, not just another state for the same code.
An administrator has a global variable set that defines AWS_REGION and tries to add AWS_REGION to a second global variable set in the same organization. What happens?
AThe set created most recently takes precedence
BHCP Terraform returns an error, because global sets cannot share a key
CBoth values are kept, and each workspace picks one in its settings
DEach workspace asks for the value at the start of its next run
Show the answer and why
AThe set created most recently takes precedence
Incorrect
Creation time never settles a conflict between variable sets; for two global sets the conflict is not allowed in the first place.
BHCP Terraform returns an error, because global sets cannot share a key
Correct
HCP Terraform reports an error if you try to declare variables with the same key in multiple global variable sets.
CBoth values are kept, and each workspace picks one in its settings
Incorrect
Workspaces have no setting for choosing between two sets' values.
DEach workspace asks for the value at the start of its next run
Incorrect
HCP Terraform does not prompt for variable values during runs.
Global sets apply to every workspace, so a duplicated key would have no sensible winner; HCP Terraform refuses it when the second set is saved.
A project administrator without organization-level permissions wants to share variables across the workspaces of their own project. What kind of variable set can they manage?
AAn organization-owned global variable set
BA project-owned variable set
CAny variable set, since sets need no permissions
DNone; only organization owners can create variable sets
Project-owned variable sets require only project permissions, while organization-owned sets need a higher permission level because they can apply anywhere.
CAny variable set, since sets need no permissions
Incorrect
Managing variable sets is permission-controlled.
DNone; only organization owners can create variable sets
Incorrect
Projects can own variable sets too.
Variable set ownership follows the permission boundary: project or organization.
A temporary workspace is no longer needed. An administrator wants to remove the infrastructure it manages and then the workspace itself. Where is this done in HCP Terraform?
AIn the project's variable sets page
BIn the organization's VCS provider settings
COn the workspace's Destruction and Deletion settings page
DBy deleting the workspace's state version in the States tab first
Show the answer and why
AIn the project's variable sets page
Incorrect
Variable sets hold variables.
BIn the organization's VCS provider settings
Incorrect
VCS settings connect repositories.
COn the workspace's Destruction and Deletion settings page
Correct
The Destruction and Deletion page lets admin users delete a workspace's managed infrastructure or delete the workspace itself.
DBy deleting the workspace's state version in the States tab first
Incorrect
Removing state does not remove infrastructure; it orphans it.
Destroy the infrastructure first, then delete the workspace, from the same settings page.
Two non-priority, workspace-scoped variable sets named A_Shared and B_Shared both set the same key for one workspace. Which value does the workspace get?
AA_Shared's, by lexical order of set names
BB_Shared's, because it was edited last
CNeither; runs fail on the conflict
DBoth values, joined as a list
Show the answer and why
AA_Shared's, by lexical order of set names
Correct
When sets with the same scope conflict, HCP Terraform uses the set whose name comes first in lexical order, regardless of edit time.
BB_Shared's, because it was edited last
Incorrect
Edit time is ignored.
CNeither; runs fail on the conflict
Incorrect
The conflict is resolved by the documented rule.
DBoth values, joined as a list
Incorrect
One value wins.
Same scope, conflicting keys: the lexically first set wins.