Bitzu

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

Single choice

What is the purpose of a project in HCP Terraform?

  1. To group workspaces and scope access to them
  2. To replace the state file of one resource
  3. To compile providers for the organization
  4. 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.

Select all that apply

Which statements about variable handling in HCP Terraform are correct?

  1. Variable sets can be owned by the organization or by a project
  2. A sensitive variable's value cannot be read back in the UI
  3. A workspace variable can override a same-key set variable
  4. Environment variables accept full HCL lists and maps
  5. 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.

True or false

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.

Download on the App StoreGet it on Google Play

More Terraform Associate 004 topics in this module