Sentinel Policy as Code with Terraform
📖 Scenario: You are working in a cloud team that uses Terraform to manage infrastructure. Your team wants to enforce a policy that limits the size of virtual machines (VMs) to control costs. You will write a Sentinel policy as code to check Terraform plans and ensure no VM exceeds a specified size.
🎯 Goal: Build a Sentinel policy that reads Terraform plan data and enforces a maximum VM size limit. This policy will help your team automatically prevent deploying VMs larger than allowed.
📋 What You'll Learn
Create a Sentinel policy file with a variable for maximum VM size
Access Terraform plan resource data in the policy
Write a rule that checks VM sizes against the maximum allowed
Return a boolean result indicating if the plan passes the policy
💡 Why This Matters
🌍 Real World
Sentinel policies help teams enforce rules automatically before infrastructure changes are applied, reducing errors and cost overruns.
💼 Career
Cloud engineers and DevOps professionals use Sentinel policies to implement governance and compliance in infrastructure as code workflows.
Progress0 / 4 steps