Terraform Associate 004 ยท HCP Terraform
Workspaces, projects and variable sets
HCP workspace vs CLI workspace, projects grouping workspaces, project-level permissions, variables and variable sets, organizing by environment or team (8c).
Key points
- An HCP Terraform workspace is a full unit of infrastructure: configuration, variables, state and run history.
- A CLI workspace is only an extra state file in one working directory.
- Projects group workspaces so access can be scoped by team or business unit, and variable sets share variables across many workspaces.
Source: https://developer.hashicorp.com/terraform/cloud-docs/workspaces
Practice questions
What is the purpose of a project in HCP Terraform?
- To group workspaces and scope access to them
- To replace the state file of one resource
- To compile providers for the organization
- To store one module version
Show answer
Answer: A. To group workspaces and scope access to them
Projects group workspaces so permissions can be scoped to a team or business unit. They are not a replacement for state files or a type of provider.
Which statements about variable handling in HCP Terraform are correct?
- Variable sets can be owned by the organization or by a project
- A sensitive variable's value cannot be read back in the UI
- A workspace variable can override a same-key set variable
- Environment variables accept full HCL lists and maps
- Variable sets only work for local-mode workspaces
Show answer
Answer: A. Variable sets can be owned by the organization or by a project, B. A sensitive variable's value cannot be read back in the UI, C. A workspace variable can override a same-key set variable
Variable sets can be owned by the organization or a project, sensitive variables are write-only in the UI, and a workspace variable with the same key and type overrides the set's value. Values are not shown back after marking sensitive.
A Terraform CLI workspace and an HCP Terraform workspace are the same thing under two names.
Show answer
Answer: False
False. A CLI workspace is an additional state file tied to one working directory, while an HCP Terraform workspace holds configuration, variables, state and run history and anchors access control.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
