Lesson 3 of 4 HCP Terraform Organization and Governance

Teams, Private Registry and Dynamic Credentials

HCP Terraform controls who can do what, shares approved building blocks and removes the need for stored cloud credentials. This lesson covers teams and permissions, the private registry and dynamic provider credentials.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe team permissions at organization, project and workspace level.
  • Explain the private registry and no-code ready modules.
  • Explain how dynamic provider credentials use workload identity.

Teams and permissions

Users join an organisation and are placed in teams; permissions are granted to teams, not to individual users. The owners team has full control of the organisation. Other teams receive permissions at three levels.

LevelExamples of permissions
OrganizationManage policies, manage VCS settings, manage the private registry, manage workspaces
ProjectRead, write, maintain, admin or custom access to all workspaces in the project
WorkspaceRead, plan, write, admin or custom: from viewing state to approving applies and changing settings

Single sign-on through SAML, with providers such as Okta or Microsoft Entra ID, can control sign-in and map identity provider groups to teams. Team API tokens let automation act with a team's permissions.

True or false

Teams and permissions

Exam skills 8.2.1

Check how HCP Terraform grants permissions.

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

The private registry

The private registry publishes modules and providers for one organisation only. Modules are published from a VCS repository, with versions from tags, or through the API, and the registry shows their documentation, inputs and outputs like the public registry. They are referenced with the hostname: app.terraform.io/example-org/network/aws. Public modules and providers can also be added to the private registry so that teams find approved choices in one place.

A module can be marked no-code ready, which lets users provision its infrastructure from the HCP Terraform UI by choosing a module and filling in its variables, without writing any configuration. HCP Terraform creates and manages a workspace for each such deployment.

Scenario questions

The private registry

Exam skills 8.2.1

Use the HCP Terraform private registry.

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

Dynamic provider credentials

Storing long-lived cloud keys in workspace variables means they can leak and must be rotated. Dynamic provider credentials use workload identity: for each run, HCP Terraform issues a signed OpenID Connect (OIDC) token that identifies the organisation, project, workspace and run phase. The cloud platform trusts HCP Terraform as an identity provider and exchanges the token for short-lived credentials.

  1. Configure trust

    In the cloud, create an OIDC identity provider for app.terraform.io and a role whose trust policy accepts tokens for specific workspaces.

  2. Set workspace variables

    For AWS, set TFC_AWS_PROVIDER_AUTH = true and TFC_AWS_RUN_ROLE_ARN to the role's ARN.

  3. Run

    Each plan and apply receives temporary credentials that expire after the run; nothing long-lived is stored.

Dynamic credentials are supported for AWS, Microsoft Azure, Google Cloud, HashiCorp Vault and Kubernetes, and can be scoped separately for the plan and apply phases, for example giving plans read-only access.

The following diagram shows how each run phase obtains its credentials.

Dynamic provider credentials replacing stored access keys. HCP Terraform gives each run a signed workload identity token; AWS trusts it through an OIDC provider and returns temporary credentials for a read-only role in the plan phase and a deployment role in the apply phase. A project-scoped variable set sets TFC_AWS_PROVIDER_AUTH and the role ARNs.
No long-lived keys are stored.
Put in order

Dynamic credentials for a run

Exam skills 8.2.3

Arrange how a run obtains short-lived cloud credentials.

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

Removing stored keys

An organisation has 40 workspaces, each with an AWS access key in sensitive environment variables. An audit requires that no long-lived cloud credentials exist and that plans cannot change infrastructure.

The decisive requirements are short-lived credentials and separate plan permissions.

The team creates an OIDC provider for HCP Terraform in AWS and two roles per environment: a read-only role trusted for the plan phase and a deployment role trusted for the apply phase. A project-scoped variable set sets TFC_AWS_PROVIDER_AUTH and the phase-specific role ARNs. The access keys are deleted, and every run now uses temporary credentials.

Check yourself

What does HCP Terraform give a cloud platform to obtain dynamic provider credentials?

Show answer

A signed OIDC workload identity token for the run, which the platform exchanges for short-lived credentials.

Exam Tips

Remember for the exam

  • Permissions go to teams at organization, project and workspace levels.
  • Private registry addresses include the hostname; no-code modules need no configuration.
  • Dynamic credentials use OIDC workload identity for AWS, Azure, GCP, Vault and Kubernetes.