Course contentsShow
← Cloud and Infrastructure
Lesson 2896 of 2,98963. Infrastructure TestingFree lesson

Terraform Sentinel Integration

Implementing Sentinel policies in Terraform Cloud/Enterprise with enforcement levels and policy sets.

Terraform Sentinel Integration

What you'll learn: How to enforce custom policies in Terraform Cloud/Enterprise using Sentinel policies with configurable enforcement levels and organized policy sets.

The Core Idea

Sentinel integration with Terraform transforms your policy-as-code rules into enforceable gates within your provisioning workflow. When you run Terraform in Cloud or Enterprise, Sentinel policies evaluate your infrastructure changes before they're applied, acting as automated governance checkpoints.

Think of Sentinel integration like a security checkpoint at an airport: your infrastructure changes (the passengers) must pass through policy evaluation (security screening) before they can proceed. The enforcement level determines what happens when a policy fails—advisory notices, soft blocking, or hard stops.

Enforcement Levels

Sentinel policies support three enforcement modes:

Advisory: Policy failures generate warnings but never block runs. Use this for recommendations or gradual policy rollout.

Soft-Mandatory: Failures block runs, but users with override permissions can proceed. Ideal for policies that need flexibility in exceptional cases.

Hard-Mandatory: Failures absolutely block runs—no exceptions. Reserve this for critical compliance requirements like preventing public S3 buckets or unencrypted databases.

Policy Sets

Policy sets group related policies and assign them to workspaces. You might create:

  • A "security-baseline" set with hard-mandatory policies for encryption
  • A "cost-control" set with soft-mandatory policies for instance sizes
  • A "tagging-standards" set with advisory policies for metadata

Policy sets enable targeted governance—different workspaces can have different policy requirements based on environment (dev vs. prod) or compliance scope (PCI vs. general).

Key Takeaway: Terraform Sentinel integration enforces infrastructure policies as automated gates with three enforcement levels (advisory, soft-mandatory, hard-mandatory) organized in policy sets for workspace-specific governance.