Product

CloudBooster Guard vs OPA and Conftest: rules you write, or checks that know your account

Open Policy Agent (OPA) and Conftest come up when a team wants rules on Terraform before it applies. CloudBooster Guard comes up for the same moment. They are different kinds of tool.

OPA is a policy engine. You write the rules, in Rego, and it evaluates them against the input you give it. Conftest is a command-line tool that runs those rules against config files. Guard is a hosted service with its own rules. Its checks judge a change against your live AWS account. It also runs 7 of them on changes made outside Terraform.

This page covers what each one does, a side-by-side table, when OPA is the better pick, and how to run both. Every claim about OPA and Conftest links to their own docs. Every claim about Guard links to ours. We checked both on 23 November 2026, against OPA v1.22, Conftest v0.71 and Guard v0.13.0.

What OPA and Conftest do

OPA is "an open source, general-purpose policy engine that unifies policy enforcement across the stack". It is licensed under Apache 2.0 and is a graduated CNCF project. Teams use it to "enforce policies in microservices, Kubernetes, CI/CD pipelines, API gateways, and more" (OPA docs).

  • Rego. Policies are written in Rego, which "is purpose-built for expressing policies over complex hierarchical data structures" (Writing policies with Rego).
  • Terraform plans. "OPA makes it possible to write policies that check the changes Terraform is about to make before it makes them." You convert the plan to JSON and run opa exec --decision terraform/analysis/authz --bundle policy/ tfplan.json (OPA and Terraform). The tutorial's policy scores a plan by its creates, changes and deletes per resource type, and refuses plans that touch IAM.
  • Input you supply. "OPA decouples policy decision-making from policy enforcement" (OPA docs). It decides on the data you pass in. A policy can also call an API with the http.send built-in (HTTP built-ins).
  • Kubernetes. Gatekeeper provides "first-class integration between OPA and Kubernetes" (OPA and Kubernetes).
  • Tested rules. "OPA also gives you a framework that you can use to write tests for your policies" (Policy testing).

Conftest "helps you write tests against structured configuration data", and "uses the Rego language from Open Policy Agent" (README). It is licensed under Apache 2.0.

  • Many formats. It parses HCL and HCL2, JSON, YAML, Dockerfiles, TOML, INI, CUE and more, so it can test .tf files directly (Evaluating policies).
  • Exceptions. An exception rule exempts matching inputs from named rules (Exceptions).
  • Shared policies. conftest pull downloads policies from a URL, over git, or from an OCI registry (Sharing).
  • CI-ready. Output as JSON, TAP, a table, JUnit, GitHub, Azure DevOps or SARIF. It exits with code 2 on a failure (Options), and --fail-on-warn makes warnings count (--fail-on-warn). conftest verify runs your policy tests (Testing policies).

You write the policies yourself, or reuse ones others publish. OPA's Terraform page notes that "there are already a number of popular tools for running policy on HCL and plan JSON" (OPA and Terraform). Conftest's repository has examples, such as a rule that denies any ingress open to 0.0.0.0/0. Platforms also run OPA for you: HCP Terraform lets you "create and manage custom policies using the open policy agent (OPA) framework" (HashiCorp docs), and Spacelift's policies use OPA and Rego (Spacelift docs).

What CloudBooster Guard does

CloudBooster Guard is a hosted service. It checks AWS infrastructure changes in two places (What Guard detects):

  • Before merge. It reviews the Terraform plan of each pull request on GitHub or merge request on GitLab. Guard plans the Terraform itself, offline and without your credentials. For a root it can't plan that way, your CI runs terraform plan and uploads the plan (Where the plan comes from).
  • Live. It reads the account's CloudTrail and judges changes made in the console, with the AWS CLI or by a CI job, within about 15 minutes (When Guard checks).

Before it grades a change, Guard resolves it against your live account. Can the internet reach the resource? Is the account production? (Resolved-effect) Guard gets those facts from a scan of the account, not from the plan. A finding is Critical only when Guard confirms every fact it needs. When a fact is missing, the finding stays at Watch and names the missing fact (Watch). What was already exposed when you connected goes into a baseline and stays quiet. Guard alerts on what is new or worse (Baseline).

Today Guard runs 26 AWS checks: 25 before merge and 7 live. What Guard detects lists each one. PR review also plans Azure, Google Cloud and Kubernetes Terraform.

You don't write rules for Guard. It runs its own catalog, with "no rule DSL to maintain" (Guard overview), and each rule has a fixed severity (Tiers). Guard reads your account through one read-only IAM role that you create (Access and data).

Side by side

OPA and ConftestCloudBooster Guard
What it isOpen-source policy engine and config-testing CLI, Apache 2.0Hosted service
RulesYou write them in Rego, or reuse published onesGuard's own catalog: 26 AWS checks, each with a fixed severity
Your own rulesAny rule you can express in RegoNot supported
What it readsThe input you pass: plan JSON, .tf files, YAML, Dockerfiles and moreTerraform plans of pull requests, plus your live AWS account
Live cloud stateOnly data you load, or fetch with http.sendEach change Guard checks is resolved against your AWS account: reachability and production
Changes made outside code (console, CLI)Evaluates the input you give it7 checks run live, from CloudTrail
Testing your rulesopa test, conftest verifyNot applicable: no rules to write
Accepting a riskAn exception rule in Rego.cbxguard/suppressions.yaml on the default branch, with a reason and an optional expiry
BlockingConftest exits 2 on a failure. You choose where it runsReports only by default. Arm the gate, then make the check required
Where results goJSON, TAP, table, JUnit, GitHub, Azure DevOps, SARIFA check and a comment on the pull request. Slack and email for live findings
Beyond TerraformKubernetes admission (Gatekeeper), services, APIs, CI/CDNone
Plans and pricesOpen source. Also built into platforms such as HCP Terraform and SpaceliftSee pricing

Sources for each row are listed at the end of this page.

When OPA and Conftest are the better pick

  • You need your organisation's own rules. Required tags, allowed regions, approved modules, a limit on how much one plan may delete. A general policy engine can express them. Guard's catalog checks exposure, and you can't add to it.
  • You want one policy language everywhere. The same Rego can guard Kubernetes admission, services, CI/CD and Terraform.
  • Your infrastructure is not only Terraform, or not only AWS. Conftest reads many file formats, and a Rego rule can check any provider's resources in the plan JSON. Guard reviews Terraform and is AWS-first.
  • Your platform already runs OPA. HCP Terraform and Spacelift run OPA policies in their own workflow.
  • You want everything open source and in your control. OPA and Conftest run wherever you run them. Guard is a hosted service that reads your account through a role you create.

When Guard is the better pick

  • You don't want to write and maintain security rules. Guard ships its checks with fixed severities. You connect a repository and an account.
  • The answer depends on the account. OPA decides on the input you give it. Whether a security group sits in front of a public host, or whether an account is production, is often not in the plan. The host may be managed in another Terraform root, or made by hand. OPA's own guide tells you to "confirm that the information you need is available in the plan JSON output" (OPA and Terraform). Guard reads that context from the account (Reachability, Production).
  • Changes skip the pull request. A console edit during an incident, a CLI call, a CI script. Guard reads them from CloudTrail and runs its 7 live checks on them.
  • You want fewer alerts. A pattern rule such as Conftest's open-ingress example fires on every match. Guard stays quiet on what was there before you connected, and holds a finding it can't confirm at Watch, which never pages (What reaches Slack).

How to use them together

OPA is good at the rules only you can write. Guard is good at exposure that depends on the account. Split the work that way.

  1. OPA or Conftest for your own rules. Tags, regions, naming, approved modules, change size. Run them in CI on the plan, or in the platform that applies your Terraform.
  2. Guard for exposure, at merge. Watch the repositories in Guard. Its cbxguard/review check grades each pull request against your accounts. Start with reports only, then arm the gate on Critical once you trust it (Choose what blocks).
  3. Guard live, on the account. Connect each account with live changes on, so Guard runs its 7 live checks on console and CLI changes. A policy that runs on the plan can't see those.

One plan, two tools. In GitLab CI, one job can write the plan JSON once. OPA evaluates it with opa exec --decision terraform/analysis/authz --bundle policy/ tfplan.json (OPA and Terraform). Guard's CI job reads the same file through CBX_GUARD_PLAN (Variables). The CI plan upload needs the Pro plan or above. Guard plans most roots itself, so you need the upload only for the roots it can't plan offline (Known limits).

Don't write the same rule twice. If Guard already checks a kind of exposure, such as public storage or wide-open IAM (What Guard detects), you don't need a Rego rule for it as well. Keep your Rego for what only your organisation knows. When you accept a risk, record it in both places: an exception rule (Exceptions) and an entry in .cbxguard/suppressions.yaml (Accept a known risk).

Frequently asked questions

Does Guard use OPA or Rego? You don't write Rego for Guard. It runs its own catalog of checks (What Guard detects).

Can I add my own rules to Guard? No. Guard's rules and their severities are fixed. You can register trusted IP ranges and bastions, which changes how a finding is graded (Tiers). Use OPA or Conftest for rules only your organisation needs.

Does Conftest ship Terraform security rules? Its repository has examples. You write or reuse the policies you run.

Does Guard need my Terraform state or cloud credentials to review a pull request? No. It plans offline and swaps your backend for an empty local one, so it never reads your state (Known limits). It judges the plan against what it reads through the read-only role.

Which AWS changes does Guard check live today? Security-group ingress opened to the public internet on a sensitive port; CloudTrail stopped or deleted; CloudTrail trail narrowed to one region or stripped of global-service events (IAM, STS); IAM grant of a wildcard action on a wildcard resource; AdministratorAccess managed policy attached to a principal; S3 bucket ACL opened to the * (everyone) grantee; S3 bucket policy opened to the * principal. What Guard detects shows where each rule runs.

Sources

Checked on 23 November 2026.

OPA (v1.22) and Conftest (v0.71):

CloudBooster Guard (v0.13.0):

Where to go from here

If you need rules only your organisation can write, OPA and Conftest are a mature open-source choice. If your production runs on AWS and you need to know when a change, from a pull request or from the console, actually exposes it, add Guard next to them.

What Guard detects lists every rule. How Guard decides explains the tiers. Plans are on our pricing section.

Know within minutes when production gets exposed — start free.

CloudBooster Guard catches risky AWS changes before merge in Terraform and within minutes in the console, CLI and CI, and alerts in Slack. One read-only IAM role. Free for 1 production account; non-production accounts are free.