Skip to main content
HashiTalks 2025 Learn about unique use cases, homelab setups, and best practices at scale at our 24-hour virtual knowledge sharing event. Register
Enforce policy as code

Secure infrastructure with policy as code

Automate guardrails for security and compliance — no extra steps needed.

Challenge

Manual processes can create security gaps

Manual, ticket-based reviews for security and compliance? Slow. Error-prone. Risky. Without guardrails, your organization is open to security breaches, audit failures, or costly over-provisioning.

Solution

Automate guardrails for seamless compliance

HCP Terraform and Terraform Enterprise step in with automatic policy enforcement to keep everything on track. By integrating Sentinel and Open Policy Agent (OPA) policy as code frameworks, you can rest assured the infrastructure your teams deploy meets security and compliance standards — without slowing them down. It’s speed and security, working together.


Benefits

Faster deployments with built-in security

Transform how your organization manages security and compliance with automated policy enforcement.

  • Reduce riskGuardrails kick in before changes happen, so your infrastructure is always compliant, reducing risks of breaches or audit failures.
  • Move fasterNo more bottlenecks. Automated policy enforcement means teams can deploy infrastructure fast while staying secure.
  • Cut costsKeep cloud spend in check by enforcing cost-centric policies that prevent over-provisioning and out-of-compliance setups. No wasted resources, no shadow IT.
Customer case study

Unlocking cloud with policy as code

AGL Energy is Australia’s largest private developer of renewable energy assets. Learn how it uses Terraform Enterprise and Sentinel policy as code in a GitOps workflow.

Resources

Get started with these resources

Explore articles, tutorials, and other content to ease collaboration and help teams work faster with Terraform.

  • Write a Sentinel policy for a Terraform deploymentCreate filters and rules for your governance requirements with the Sentinel policy language.
  • Upload your Sentinel policy set to HCP TerraformCreate and upload a Sentinel policy set, then apply it to your HCP Terraform organization.
  • Detect infrastructure drift and enforce OPA policiesUse Terraform preconditions and HCP Terraform native OPA support to validate configuration and enforce compliance with organizational practices.
  • Defining policiesSentinel policies can be created for every stage of the Terraform workflow, including the configuration, plan, run, and state.
  • Manage policy setsPolicy sets are collections of Sentinel or OPA policies you can apply to your workloads in HCP Terraform.
  • Mocking Terraform Sentinel dataAn important part of the test process is mocking the data that you want your policies to operate on.