Course contentsShow
← Cloud and Infrastructure
Lesson 2341 of 2,98950. Compliance and GovernanceFree lesson

Terraform Sentinel Overview

Exploring HashiCorp Sentinel as a policy-as-code framework for governance in Terraform Enterprise.

Terraform Sentinel Overview

You'll learn what HashiCorp Sentinel is and why it's the enterprise policy-as-code solution for Terraform governance.

What is Terraform Sentinel?

HashiCorp Sentinel is a policy-as-code framework embedded in Terraform Enterprise and Terraform Cloud (Business tier) that enforces rules before infrastructure changes are applied. Think of Sentinel as a security guard at the door of your infrastructure—checking every proposed change against your organization's policies and either allowing it through, warning about issues, or blocking it entirely.

Unlike Open Policy Agent (OPA), which you've already learned as a general-purpose policy engine, Sentinel is purpose-built for HashiCorp products and deeply integrated into the Terraform workflow.

How Sentinel Fits Into Terraform

Sentinel policies execute between the plan and apply stages. After Terraform generates a plan showing what will change, Sentinel evaluates that plan against your written policies before anyone can click "apply." This prevents non-compliant infrastructure from ever being created.

Core Components

Policy Language: Sentinel uses its own domain-specific language designed for expressing rules. It's more prescriptive than OPA's Rego but optimized for infrastructure governance.

Policy Enforcement Levels: Policies can be advisory (warning only), soft-mandatory (blockable by override), or hard-mandatory (absolute block).

Sentinel Imports: Pre-built libraries give you access to Terraform plan data, state, and configuration—letting you inspect proposed resources, check naming conventions, verify tags, or ensure approved AMIs are used.

Common Use Cases

  • Enforcing tagging standards on all resources
  • Restricting which regions resources can be deployed to
  • Preventing public internet access for databases
  • Requiring encryption for storage resources
  • Validating cost estimates before deployment

Key Takeaway: Sentinel is Terraform Enterprise's built-in policy-as-code framework that enforces organizational governance by validating infrastructure plans before they're applied, preventing compliance violations before resources are created.