Bitzu

Terraform Associate 004 ยท HCP Terraform

Connecting configuration to HCP Terraform

cloud block in configuration, terraform login and API tokens, VCS connection, dynamic provider credentials (8d).

Key points

  • A cloud block inside the terraform block names the organization and the workspace (by name, or by tags and project). terraform login authenticates you with an API token.
  • VCS connections trigger runs from a repository, and dynamic provider credentials use OIDC to give each run short-lived cloud credentials.

Source: https://developer.hashicorp.com/terraform/cli/cloud/settings

Practice questions

Single choice

Which command is recommended for authenticating the Terraform CLI with HCP Terraform?

  1. terraform auth sync
  2. terraform login
  3. terraform connect
  4. terraform token create
Show answer

Answer: B. terraform login

terraform login obtains an API token for the CLI. terraform init alone does not authenticate, and the other commands do not exist for this purpose.

Select all that apply

Which settings can appear in the cloud block?

  1. organization
  2. hostname
  3. workspaces with name, tags or project
  4. A cloud provider's default region
  5. The list of providers to install
Show answer

Answer: A. organization, B. hostname, C. workspaces with name, tags or project

The cloud block takes organization, an optional hostname and a workspaces block with name or tags and an optional project. A provider region is a provider argument, not a cloud block setting.

True or false

In the cloud block's workspaces setting you can use both name and tags at the same time.

Show answer

Answer: False

False. The name argument links one existing workspace and cannot be combined with tags, which match several workspaces.

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