Course contentsShow
← Security
Lesson 3022 of 3,05256. Security Automation and ToolingFree lesson

HashiCorp Sentinel

Using Sentinel for policy enforcement in Terraform, Vault, and other HashiCorp tools with policy-as-code workflows.

HashiCorp Sentinel

What you'll learn: How HashiCorp Sentinel enables fine-grained policy enforcement across HashiCorp tools using an embedded policy-as-code framework.

What is Sentinel?

HashiCorp Sentinel is a policy-as-code framework embedded in HashiCorp's enterprise products (Terraform, Vault, Consul, Nomad). Unlike OPA which you've already learned, Sentinel is tightly integrated into HashiCorp workflows and uses its own policy language designed specifically for HashiCorp tooling.

Think of Sentinel as a security checkpoint built directly into your infrastructure tooling—every change request must pass through your policies before execution.

How Sentinel Works

Sentinel policies are written in the Sentinel language (not Rego) and evaluate against imported data from the HashiCorp tool. Each policy returns a boolean: pass or fail.

In Terraform Cloud/Enterprise, Sentinel policies can inspect:

  • Planned resource changes before apply
  • Cost estimates
  • Configuration attributes
  • State data

In Vault, Sentinel policies control:

  • Path-based access decisions beyond standard ACLs
  • Token creation parameters
  • Secret engine operations

Policy Enforcement Levels

Sentinel supports three enforcement levels:

  • Advisory: Warning only, doesn't block
  • Soft-mandatory: Can be overridden by authorized users
  • Hard-mandatory: Cannot be overridden

This flexibility lets you gradually roll out policies or allow exceptions for emergencies.

Integration Pattern

Sentinel policies execute before the operation completes. In Terraform, this means between plan and apply. The policy receives the plan data, evaluates your rules, and either permits or blocks the operation.

Key Takeaway: HashiCorp Sentinel provides native policy-as-code enforcement within HashiCorp tools, enabling security teams to codify and automatically enforce guardrails on infrastructure changes, secret access, and operations with granular control over enforcement strictness.