Terraform Associate Domain 8: HCP Terraform
20 free practice questions for HCP Terraform in the HashiCorp Certified: Terraform Associate (004) exam. Try each question first, then open "Show answer" for the correct option and explanation.
HCP Terraform practice questions
-
Question 1. What is HCP Terraform?
Show answer
Answer: B. HashiCorp's managed service for running Terraform with shared state and collaboration
HCP Terraform, formerly Terraform Cloud, stores state, runs plans and applies, and adds access control, policies, and a private registry.
-
Question 2. Which block connects a configuration to HCP Terraform?
Show answer
Answer: A. A cloud block inside the terraform block
The cloud block sets the organization and the workspace (by name or by tags). Run terraform init after adding it.
-
Question 3. Which command gets an API token so the CLI can use HCP Terraform?
Show answer
Answer: D. terraform login
It opens a browser to create a token and saves it in the CLI credentials file.
-
Question 4. What does an HCP Terraform workspace hold?
Show answer
Answer: C. A configuration's state, variables, permissions, and run history
HCP Terraform workspaces are more than CLI workspaces: each is a unit of access control and run history.
-
Question 5. What are projects in HCP Terraform for?
Show answer
Answer: A. Grouping related workspaces and granting teams access to them
Projects make permissions and variable sets easier to manage as the number of workspaces grows.
-
Question 6. In the VCS-driven workflow, what starts runs?
Show answer
Answer: B. Commits and pull requests in the connected repository
Pushes to the tracked branch queue runs; pull requests get speculative plans.
-
Question 7. In the CLI-driven workflow with HCP Terraform, what happens when you run terraform plan locally?
Show answer
Answer: D. The plan runs remotely and streams its output to your terminal
Your local files are uploaded, the run executes in HCP Terraform, and its output is streamed back.
-
Question 8. Which workflow lets an external tool, such as a custom pipeline, upload configuration and start runs?
Show answer
Answer: C. The API-driven workflow
It gives full control over when runs happen and what's uploaded, at the cost of more integration work.
-
Question 9. What is a speculative plan in HCP Terraform?
Show answer
Answer: A. A plan-only run, for example on a pull request, that can't be applied
It shows reviewers the effect of a change before it's merged.
-
Question 10. What is a variable set?
Show answer
Answer: B. A group of variables shared across several workspaces or projects
For example, cloud credentials applied to every workspace in a project.
-
Question 11. A variable in HCP Terraform is marked sensitive. What happens to it?
Show answer
Answer: D. It becomes write-only and can't be read back in the UI or API
Terraform runs still receive the value, but people can only replace it, not view it.
-
Question 12. Where do Sentinel or OPA policies run in an HCP Terraform run?
Show answer
Answer: B. After the plan and before the apply
Policies check the plan, for example to block untagged resources or oversized instances, before anything changes.
-
Question 13. What are run tasks in HCP Terraform?
Show answer
Answer: C. Integrations that call external services, such as scanners, during a run
Run tasks can pass or fail a run based on the external service's result.
-
Question 14. By default, where do HCP Terraform runs execute?
Show answer
Answer: A. On HCP Terraform's managed workers
Local execution mode can be selected per workspace, keeping only state in HCP Terraform.
-
Question 15. Your resources are only reachable from a private network. How can HCP Terraform manage them?
Show answer
Answer: D. By running HCP Terraform agents inside that network
Agents poll HCP Terraform for work and run Terraform from within your network.
-
Question 16. What does HCP Terraform's health assessment feature, drift detection, do?
Show answer
Answer: B. Checks regularly whether real infrastructure has drifted from state
It alerts you to drift without anyone running a plan. Continuous validation also re-runs check blocks.
-
Question 17. How are permissions to workspaces granted in HCP Terraform?
Show answer
Answer: C. To teams, at organization, project, or workspace level
Users join teams, and teams get roles such as read, plan, write, or admin on projects and workspaces.
-
Question 18. What does a run trigger do?
Show answer
Answer: A. Queues a run in one workspace when another workspace applies successfully
It's useful when one workspace consumes another's outputs, such as an app depending on a network workspace.
-
Question 19. Which HCP Terraform feature shows a cost estimate for supported resources during a run?
Show answer
Answer: D. Cost estimation
It runs after the plan, and policies can use its results, for example to block expensive changes.
-
Question 20. The cloud block selects workspaces with tags instead of a single name. How do you choose which workspace a command uses?
Show answer
Answer: B. Use terraform workspace select
With tags, several workspaces match, so you pick one with terraform workspace select or the TF_WORKSPACE variable.
HashiCorp, Terraform, and HCP Terraform are trademarks of HashiCorp, Inc. These questions are original study material, not questions from the real exam.