002 · Domain 5: Terraform Security and Governance · 13% of the exam
Task 5.3: Secure CI/CD pipeline identities and access
Least privilege for automation: dynamic provider credentials, scoped API tokens, separate plan and apply identities, and keeping credentials out of variables and logs.
Try each one before opening the answer. Every option is explained, with the HashiCorp documentation page that proves it.
Question 1 · choose 1
A platform pipeline authenticates to HCP Terraform with the organization API token. It creates workspaces and teams without trouble, but every attempt to upload a configuration version and start a run in those workspaces is rejected. Which explanation is correct?
AOrganization tokens expire after thirty days
BThe workspaces must first be locked by the token before it can start runs in them
COrganization tokens cannot create configuration versions or start runs
DOrganization tokens can upload a configuration version only to workspaces created in the UI
Show the answer and why
AOrganization tokens expire after thirty days
Incorrect
Tokens have an expiration chosen when they are created, and the pipeline's other calls still succeed with the same token.
BThe workspaces must first be locked by the token before it can start runs in them
Incorrect
Starting a run does not require locking the workspace, and a locked workspace would block runs rather than allow them.
COrganization tokens cannot create configuration versions or start runs
Correct
Organization tokens are meant for setting up workspaces and teams; the run and configuration version endpoints require a user or team token.
DOrganization tokens can upload a configuration version only to workspaces created in the UI
Incorrect
Organization tokens act across the whole organization regardless of how a workspace was created; the limitation is on the kinds of operation.
Use organization tokens for initial setup, then hand routine work such as runs to team tokens with the access each team needs.
Integration tests for a private registry module use dynamic credentials, and the longest test run is rejected by the cloud near its end because its token has expired. What can the organization change?
ASet a token lifetime variable in the module's test file
BOwners raise module_test_token_ttl in the Organizations API
CNothing; HCP Terraform fixes test tokens at 5 minutes
DRun the tests in the apply phase, whose tokens are valid for longer
Show the answer and why
ASet a token lifetime variable in the module's test file
Incorrect
The test token lifetime is an organization setting, not a test file setting.
BOwners raise module_test_token_ttl in the Organizations API
Correct
Module test tokens have their own time to live, from 5 to 30 minutes, which organization owners set with the module_test_token_ttl attribute.
CNothing; HCP Terraform fixes test tokens at 5 minutes
Incorrect
The time to live ranges from 5 to 30 minutes, and owners can adjust it.
DRun the tests in the apply phase, whose tokens are valid for longer
Incorrect
Module test runs always use the plan phase.
Keep the test token lifetime as short as the longest test run allows, so a leaked token stays useful for as little time as possible.