Lesson 1 of 4 HCP Terraform Organization and Governance

Organizations, Projects and Workspaces

HCP Terraform organises infrastructure in a three-level hierarchy. This lesson explains each level and how to split infrastructure into workspaces and projects.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the organization, project and workspace hierarchy.
  • Explain how to split infrastructure into workspaces and projects.
  • Distinguish HCP Terraform workspaces from CLI workspaces.

The hierarchy

An organization is the top-level container. It holds users and teams, settings such as single sign-on and VCS connections, the private registry, policy sets, variable sets and the subscription. Users can belong to several organisations, each with its own edition.

A project groups related workspaces, and Stacks, inside an organisation, for example all workspaces for one application, business unit or environment. Teams can be granted access to a project as a whole, and workspaces created in the project inherit that access. Every workspace belongs to exactly one project, the Default Project unless another is chosen. Variable sets and policy sets can be scoped to projects.

A workspace manages one root module configuration. It contains the configuration's state and state history, variables, run history, settings such as the Terraform version, execution mode, VCS connection and auto-apply, and its permissions.

LevelContainsTypical boundary
OrganizationUsers, teams, projects, settings, registry, policies, billingA company or a large division
ProjectWorkspaces and Stacks; team access; scoped variable and policy setsAn application, team or business unit
WorkspaceOne configuration's state, variables, runs and settingsOne component in one environment

The following diagram shows projects and workspaces in an organisation.

One project per owner in the HCP Terraform organisation. The network project holds network-prod and network-dev; each application project holds its prod and dev workspaces. Each team gets write or maintain access to its own project, and new workspaces in the project inherit that access.
The names are illustrative.
Sort into groups

Organisation, project or workspace?

Exam skills 8.3.1

Decide which level of HCP Terraform holds each item.

Log in to try this activity Interactive activities are free with an account.

Splitting infrastructure into workspaces

A workspace should manage a set of resources that change together and share an owner. HashiCorp recommends splitting by component and environment, with names such as network-prod, app-prod and app-dev, rather than one workspace for everything. Smaller workspaces have a smaller blast radius, faster plans and permissions that match responsibilities: the network team can write to network workspaces while the application team only reads them.

HCP Terraform workspaces are different from CLI workspaces. A CLI workspace is only an extra state for the same configuration and backend; an HCP Terraform workspace is a full unit of management with its own variables, permissions, run queue and settings.

CLI workspace
Created withterraform workspace new
Own variablesNo
Own permissionsNo
Run history and queueNo
HCP Terraform workspace
Created withThe UI, API, tfe provider or cloud block
Own variablesYes
Own permissionsYes
Run history and queueYes
True or false

Designing workspaces

Exam skills 8.3.1

Check good practice for splitting infrastructure into HCP Terraform workspaces.

Log in to try this activity Interactive activities are free with an account.
Worked example

Organising a platform

A company has a shared network and three applications, each with dev and prod environments. Each application team should manage only its own infrastructure, and the network team owns the network.

The decisive requirements are ownership boundaries and environments.

A sensible layout is one project per owner, network, app-a, app-b and app-c, with workspaces such as network-prod and network-dev in the network project and app-a-prod and app-a-dev in app-a. Each team receives write or maintain access to its own project, and new workspaces in that project inherit the access automatically.

Check yourself

What does an HCP Terraform workspace manage?

Show answer

One root module configuration, with its own state, variables, run history, settings and permissions.

Exam Tips

Remember for the exam

  • Organization > project > workspace.
  • Projects group workspaces and carry team access to all of them.
  • One workspace = one root configuration with its own state, variables and runs.
  • Split workspaces by component and environment.