Freedom251 › Infrastructure Policy as Code Tools
terraform-compliance

What terraform-compliance is
terraform-compliance is a free, open-source test framework for checking Terraform infrastructure as code against security and compliance policies. It takes Terraform plan or state output as input and can also work with plan output converted to JSON. The project says it supports Terraform versions newer than 0.12 and works with any Terraform provider.
Policies are written as behavior-driven feature files. In a scenario, Given steps establish context, When steps filter that context, and Then steps fail the scenario if their conditions are not met. Feature files can come from a directory or a Git repository; SSH key authentication is available for private repositories. Checks can run before deployment, in a pipeline, or through git hooks. Documentation includes CI/CD examples for CircleCI and GitHub Actions.
Installation options include pip, which requires Python 3.x, and Docker. Supported controls include treating failures as warnings, failing scenarios when steps skip, case-sensitive matching, and excluding resources. The project is distributed under the MIT license. It supports policy testing, admission control, CI/CD integration, and policy reporting, but does not provide runtime enforcement.
Who it suits
terraform-compliance suits developers and security teams who want to express Terraform security and compliance checks as readable BDD-style policies. It can also suit teams that keep policy files in a separate repository and run checks before deployment or in CI pipelines and git hooks.
What it does well
- Free to use and distributed under the MIT license.
- Works with any Terraform provider.
- Policies use behavior-driven feature files.
- Feature files can be loaded from directories or Git repositories.
- Documentation includes CircleCI and GitHub Actions examples.
- Supports admission control and policy reporting.
What to know first
- Checks Terraform plan or state output rather than other listed IaC formats.
- Runtime enforcement is not supported.
- The pip installation route requires Python 3.x.
Limits
The tool is for Terraform plan and state output, including JSON-converted plan output, and does not provide runtime enforcement.
Plans
| Plan | Billed and limits | Price |
|---|---|---|
| terraform-compliance | Open-source Terraform compliance testing framework | Free |
As terraform-compliance.com lists them, read 4 Oct 2026. The maker's own page has the final word.
Getting started
- Visit https://terraform-compliance.com/.
- Install through pip, which requires Python 3.x, or use Docker.
- Provide Terraform plan or state output, or plan output converted to JSON.
- Supply feature files from a directory or Git repository; use SSH key authentication for a private repository if needed.
- Run checks before deployment, in a pipeline, or through git hooks.
Verdict
Pick terraform-compliance if you need free policy tests for Terraform and want rules expressed in readable scenarios. Look elsewhere if you need runtime enforcement or policy testing for infrastructure formats beyond Terraform plan and state output.
Questions
Is terraform-compliance free?
Yes. The listed plan is free, and the project says it is open source and free to use.
What license does it use?
The project says it is distributed under the MIT license.
Which Terraform versions and providers does it support?
The overview says it supports Terraform versions newer than 0.12 and works with any Terraform provider.
How are policies written?
Policies use BDD-style feature files with Given, When, and Then steps.
How can I install it?
Documentation provides pip and Docker installation. The pip route requires Python 3.x.
Does it support CI/CD and runtime enforcement?
Documentation includes CI/CD examples for CircleCI and GitHub Actions, and the listed capabilities include CI/CD integration. Runtime enforcement is not supported.
Facts from terraform-compliance's own pages
- BDD behavior
- Given steps set the test context, When steps filter it, and Then steps fail the scenario when their conditions are not met. · terraform-compliance.com, 4 Oct 2026
- CI integrations
- The documentation includes CI/CD examples for CircleCI and GitHub Actions. · terraform-compliance.com, 4 Oct 2026
- Compliance controls
- Supported tags include ways to turn failures into warnings, fail scenarios when steps skip, match case sensitively, and exclude resources. · terraform-compliance.com, 4 Oct 2026
- Feature sources
- Feature files can be read from a directory or a Git repository, with SSH key authentication available for private repositories. · terraform-compliance.com, 4 Oct 2026
- Install options
- The documentation provides installation through pip and Docker; pip installation requires Python 3.x. · terraform-compliance.com, 4 Oct 2026
- Intended users
- The project describes policies that developers and security teams can read and says tests can be kept in a separate repository owned by another team. · terraform-compliance.com, 4 Oct 2026
- License
- The maker’s site says the project is open source, free to use, and distributed under the MIT license. · terraform-compliance.com, 4 Oct 2026
- Policy tests
- It tests Terraform plans against policies written as behavior-driven development features and scenarios. · terraform-compliance.com, 4 Oct 2026
- Provider support
- The project says it works with any Terraform provider. · terraform-compliance.com, 4 Oct 2026
- Purpose
- terraform-compliance is a lightweight, security- and compliance-focused test framework for negative testing of infrastructure as code written with Terraform. · terraform-compliance.com, 4 Oct 2026
- Terraform input
- The tool requires a Terraform plan or state output as input and can also run against JSON-converted plan output. · terraform-compliance.com, 4 Oct 2026
- Terraform version support
- The overview says terraform-compliance supports Terraform versions newer than 0.12. · terraform-compliance.com, 4 Oct 2026
- Validation timing
- The project describes validating code before deployment and running checks in a pipeline or git hooks. · terraform-compliance.com, 4 Oct 2026
Where terraform-compliance stands on Freedom251
- Infrastructure Policy as Code Tools#16 of 25
- IaC Security Scanners#11 of 16
- Infrastructure Testing Tools#20 of 28