HashiCorp Terraform Associate (004) · 13% practice allocation

HashiCorp 004: HCP Terraform Practice Questions

5 free sample questions from the HCP Terraform domain, with answers and explanations. The full 004 bank has 282 questions across 8 domains. Questions are scenario-based and written from the official HashiCorp exam guide.

1.

A growing engineering organization uses HCP Terraform and wants to begin enforcing cost governance. They attach a Sentinel policy set at the organization level containing a single policy configured as enforcement_level = "soft-mandatory". The policy checks that the estimated monthly cost increase of any plan does not exceed $500. A workspace run produces a plan whose estimated cost increase is $620, causing the policy check to fail. Which TWO statements accurately describe what happens next?

  • A. The run is immediately and permanently discarded; no user can proceed with the apply.
  • B. A user with the 'Manage Policies' permission or higher can override the policy failure and allow the apply to proceed.✓ Correct
  • C. The apply proceeds automatically because soft-mandatory policies are advisory only and never block an apply.
  • D. The run halts at the policy check stage and cannot proceed to apply without an override or policy change.✓ Correct
  • E. The policy failure is logged but the run automatically proceeds to apply after a 10-minute grace period.
  • F. Only a workspace-level admin can override a soft-mandatory policy; organization-level admins cannot.
Explanation

A soft-mandatory policy failure causes the run to halt at the policy check stage and display a 'Policy check soft failed' status — it does not auto-apply (Option 3 is correct). However, unlike a hard-mandatory failure, it CAN be overridden: a user with the 'Manage Policies' permission (typically organization owners or policy managers) can click 'Override & Continue' to allow the apply to proceed despite the failure (Option 1 is correct). — Option A is wrong because the run is not permanently discarded; it remains in a paused state and can be overridden or the plan can be discarded manually. — Option C is wrong because that describes an 'advisory' enforcement level, not soft-mandatory. Advisory policies log the failure but never block the apply. Soft-mandatory DOES block unless overridden. — Option E is wrong because there is no automatic grace period or timer in HCP Terraform policy checks; the run waits indefinitely for a human action. — Option F is wrong because the override permission is tied to the 'Manage Policies' permission at the organization level, not solely to workspace-level admins.

2.

A HCP Terraform workspace is configured with the execution mode set to 'Local'. What is the effect of this setting?

  • A. Terraform operations are performed on the local machine where the CLI is invoked, but state is still stored in HCP Terraform.✓ Correct
  • B. HCP Terraform will only execute plans locally during business hours and switch to remote execution at other times.
  • C. Terraform operations run on HCP Terraform's managed runner infrastructure, but state is stored locally on the engineer's workstation.
  • D. The workspace is read-only in the HCP Terraform UI and all changes must be made through the API.
Explanation

Option A is correct. When an HCP Terraform workspace execution mode is set to 'Local', the Terraform CLI runs plan and apply operations on the local machine (the engineer's laptop or CI runner), but the workspace's remote state backend in HCP Terraform is still used for state storage and locking. This gives teams centralized state management without the overhead of remote execution. Option C is wrong because it inverts the behavior—local mode means local execution, not local state. Option D is wrong because local execution mode does not make the workspace read-only; it remains fully manageable. Option B is wrong because there is no time-based execution mode switching; execution mode is a static workspace setting.

3.

A platform engineer is setting up a new HCP Terraform workspace for the production environment. They want every terraform apply to require a human to review and approve the plan output before infrastructure changes are made — even when the run is triggered automatically by a VCS push. Which workspace setting should they configure to enforce this behavior?

  • A. Set the execution mode to 'Local' so the engineer must manually run terraform apply from their workstation.
  • B. Attach a Sentinel hard-mandatory policy that blocks all applies until an operator adds an override comment in the run UI.
  • C. Set the execution mode to 'Remote' and leave 'Auto apply' disabled so every run pauses for confirmation after planning.✓ Correct
  • D. Set the execution mode to 'Remote' and enable the 'Auto apply' toggle in workspace settings.
Explanation

When an HCP Terraform workspace uses Remote execution mode with 'Auto apply' disabled (the default), every run pauses at the 'planned' state after the plan phase and waits for a user with appropriate permissions to click 'Confirm & Apply'. This is the built-in mechanism for requiring human approval before any apply proceeds, regardless of how the run was triggered. — Option D is wrong because enabling 'Auto apply' causes runs to proceed to apply automatically without human confirmation, which is the opposite of what is required. — Option A is wrong because Local execution mode offloads the plan and apply to the engineer's local machine; HCP Terraform only stores state. It does not provide a centralized approval gate inside the platform for team-based review. — Option B is wrong because Sentinel policies gate applies based on policy logic, not on a blanket 'pause for human review' pattern. Sentinel is a policy-as-code governance tool and cannot be configured to simply require an operator comment as a generic approval mechanism; the correct purpose-built feature for approval gates is disabling Auto apply.

4.

A security team wants to enforce a policy that prevents any Terraform plan from creating AWS security groups with ingress rules open to 0.0.0.0/0. They want the run to be blocked and not allowed to proceed to apply under any circumstances if this condition is violated. Which Sentinel policy enforcement level should they configure?

  • A. advisory
  • B. soft-mandatory
  • C. hard-mandatory✓ Correct
  • D. strict
Explanation

Option C is correct. A hard-mandatory Sentinel policy cannot be overridden by anyone, including organization owners. If the policy fails, the run is permanently blocked from proceeding to apply with no override path. Option A (advisory) is wrong because advisory policies log a warning but never block a run—the apply proceeds regardless. Option B (soft-mandatory) is wrong because soft-mandatory policies can be overridden by users with appropriate permissions (typically organization owners or policy override privileges), which does not meet the requirement of 'no circumstances' override. Option D (strict) is wrong because 'strict' is not a valid Sentinel enforcement level in HCP Terraform; the three valid levels are advisory, soft-mandatory, and hard-mandatory.

5.

A platform team wants to share internally developed Terraform modules across multiple teams in their organization using HCP Terraform. They want modules to be versioned, searchable in a UI, and consumable without exposing the underlying VCS repository credentials to end users. Which HCP Terraform feature best satisfies these requirements?

  • A. HCP Terraform remote state sharing
  • B. HCP Terraform private module registry✓ Correct
  • C. A shared HCP Terraform workspace used as a module source
  • D. HCP Terraform run triggers between workspaces
Explanation

Option B is correct. The HCP Terraform private module registry allows organizations to publish versioned modules sourced from VCS repositories. Team members can browse and consume them using the app.terraform.io/<org>/<module>/<provider> source format without needing direct VCS access or credentials. Option A (remote state sharing) is wrong because that feature shares output values between workspaces—it is not a module distribution mechanism. Option C is wrong because a workspace is not a valid Terraform module source path and does not provide versioning or a browsable registry UI. Option D (run triggers) is wrong because that feature allows one workspace to trigger a run in another workspace after a successful apply—it is not related to module distribution.

Test yourself across every 004 domain

The free 004 practice test mixes about 20 questions weighted like the exam. The full 282-question bank adds instant grading, flashcards and a timed mock exam.

Study this domain

HCP Terraform study guide (004) →

Other 004 domains

← All HashiCorp Terraform Associate study resources