Policy Enforcement, Health Assessments and Explorer
HCP Terraform's governance features check runs against rules, watch infrastructure after deployment and report across the organisation. This lesson covers policies, run tasks, health assessments, explorer and change requests.
Learning outcomes
After completing this lesson, you will be able to:
- Describe policy sets and Sentinel and OPA enforcement levels.
- Explain drift detection and continuous validation.
- Describe the purpose of explorer and change requests.
Policy enforcement
Policy as code expresses rules that every run must follow, such as "all buckets must be encrypted" or "only approved instance types". HCP Terraform supports two policy languages: Sentinel, HashiCorp's own language, and Open Policy Agent (OPA), which uses the Rego language. Policies are grouped into policy sets, usually stored in a VCS repository, and applied to the whole organisation, to projects or to selected workspaces.
Policies are evaluated after the plan and before the apply, against the plan, the configuration and the state. The enforcement level decides what happens when a policy fails.
| Enforcement level | Language | On failure |
|---|---|---|
| Advisory | Sentinel and OPA | Warning; the run continues |
| Soft-mandatory | Sentinel | The run stops unless a user with permission overrides it |
| Hard-mandatory | Sentinel | The run stops; no override is possible |
| Mandatory | OPA | The run stops unless a user with permission overrides it |
Policy enforcement is available in the Standard and Premium editions; check the current plans.
The following diagram compares the three Sentinel enforcement levels.

Enforcement levels
Run tasks
Run tasks connect runs to external services, such as security scanners, cost management tools or ticketing systems. At a chosen stage, pre-plan, post-plan, pre-apply or post-apply, HCP Terraform sends run details to the service and waits for its result. A task configured as mandatory stops the run if the service reports a failure; an advisory task only shows the result.
Which governance feature?
Health assessments
After apply, infrastructure can still drift or degrade. Health assessments run automatically on a schedule in eligible workspaces and include two evaluations. Drift detection runs a refresh-only plan to find differences between real infrastructure and state. Continuous validation re-evaluates the configuration's custom conditions, including check blocks, so a certificate that is about to expire or a health endpoint that fails is reported without a new run. Results appear on the workspace's Health page and can trigger notifications.
Assessments require remote or agent execution mode and a successful apply, are paused while the latest run is in an errored state, and never interfere with runs. Organisation owners can enforce them across all workspaces. Health assessments are available in the Standard and Premium editions.
Health assessments
Explorer and change requests
The explorer gives a queryable view of the whole organisation. Built-in queries list workspaces with drift or failed checks, the most used module and provider versions, the Terraform versions in use, workspaces by VCS repository and runs by status, and the query builder filters any field. It answers questions such as "which workspaces still use module version 1.x?".
From explorer results, administrators can create change requests: action items recorded on the selected workspaces, such as upgrading a deprecated module, applying a security fix or correcting a compliance problem. Team notifications can alert workspace owners, and owners archive a request when it is done. Change requests are available in the Standard and Premium editions.
Enforcing encryption
A compliance team requires that no unencrypted storage is ever created, with no exceptions, and wants to know which existing workspaces still use an old storage module that predates the rule.
The decisive requirements are a block that cannot be overridden, and an organisation-wide inventory.
A Sentinel policy that checks every planned storage resource for encryption, in a policy set applied to the organisation with the hard-mandatory enforcement level, blocks any non-compliant run without override. A soft-mandatory level would let authorised users override it, which the rule forbids. An explorer query on module versions finds the workspaces using the old module, and change requests record the upgrade on each of them.
Which Sentinel enforcement level blocks a run with no possibility of override?
Show answer
Hard-mandatory.
Exam Tips
Remember for the exam
- Sentinel levels: advisory, soft-mandatory (overridable), hard-mandatory (not overridable).
- Policies run after plan and before apply.
- Health assessments: drift detection plus continuous validation, on a schedule.
- Explorer queries the organisation; change requests record work on workspaces.