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
Which command is recommended for authenticating the Terraform CLI with HCP Terraform?
- terraform auth sync
- terraform login
- terraform connect
- 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.
Which settings can appear in the cloud block?
- organization
- hostname
- workspaces with name, tags or project
- A cloud provider's default region
- 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.
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.
