46m

Writing OPA Policies in Terraform Cloud | Builder Session

What if Terraform could flag insecure EC2 configurations every time you run a plan? In this DevSec Blueprint Builder Session, Damien Burks takes an Open Policy Agent (OPA) policy from a local demo and puts it to work in HCP Terraform, formerly Terraform Cloud. The policy flags Amazon EC2 instances that don’t explicitly require Instance Metadata Service Version 2 (IMDSv2). Follow the demo from setting up AWS authentication with OpenID Connect (OIDC) to running a remote Terraform plan and reviewing policy warnings in both the HCP Terraform UI and the CLI. You’ll learn how to: - Connect HCP Terraform to AWS using OIDC and an IAM role for short-lived credentials. - Use a project-level variable set to share AWS authentication settings across workspaces. - Trigger a remote Terraform plan from the CLI and inspect the run in HCP Terraform. - Add a Rego policy to a policy set and scope it to selected workspaces or the entire organization. - Verify that the policy flags EC2 instances with missing metadata options or optional metadata tokens. The session closes with a discussion of how advisory checks surface violations and how mandatory enforcement can block noncompliant changes before they’re applied.

Topics Covered

HCP TerraformTerraform CloudOpen Policy AgentOPARegoTerraform Policy as CodePolicy as CodeTerraform Policy SetsTerraform PlanAmazon EC2IMDSv2AWS OIDCAWS IAMDynamic Provider CredentialsInfrastructure as CodeTerraform SecurityCloud SecurityDevSecOpsDevSec Blueprint

Instructor

  • Damien Burks

Video Details

Duration
46m
Recorded
11/14/2026
Published
11/14/2026
Topics
19

Watch This Video

This video is available to Builder members. Sign up or upgrade your membership to watch the full video.