terraform-compliance
terraform-compliance.com
What it is
terraform-compliance is a free, open-source framework for security and compliance testing of Terraform infrastructure as code. It checks Terraform plan or state output against policies written as behavior-driven feature files, and it can read plan output converted to JSON. Given steps establish context, When steps filter it, and Then steps fail scenarios when conditions are unmet. The project says it works with any Terraform provider and supports Terraform versions newer than 0.12. Checks can run before deployment, in pipelines, or through git hooks. Feature files may come from a local directory or Git repository, with SSH authentication for private repositories. Installation is documented through pip, requiring Python 3.x, or Docker. CI/CD examples cover CircleCI and GitHub Actions. Controls include warning-only failures, skipped-step failures, case-sensitive matching, and resource exclusion. The tool supports policy testing, admission control, and policy reporting, but not runtime enforcement. Its MIT license permits free use.
Spec sheet
- Purpose
- terraform-compliance is a lightweight, security- and compliance-focused test framework for negative testing of infrastructure as code written with Terraform.Read 4 Oct 2026 · terraform-compliance.com
- 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.Read 4 Oct 2026 · terraform-compliance.com
- License
- The maker’s site says the project is open source, free to use, and distributed under the MIT license.Read 4 Oct 2026 · terraform-compliance.com
- BDD behavior
- Given steps set the test context, When steps filter it, and Then steps fail the scenario when their conditions are not met.Read 4 Oct 2026 · terraform-compliance.com
- CI integrations
- The documentation includes CI/CD examples for CircleCI and GitHub Actions.Read 4 Oct 2026 · terraform-compliance.com
- Compliance controls
- Supported tags include ways to turn failures into warnings, fail scenarios when steps skip, match case sensitively, and exclude resources.Read 4 Oct 2026 · terraform-compliance.com
- Feature sources
- Feature files can be read from a directory or a Git repository, with SSH key authentication available for private repositories.Read 4 Oct 2026 · terraform-compliance.com
- Install options
- The documentation provides installation through pip and Docker; pip installation requires Python 3.x.Read 4 Oct 2026 · terraform-compliance.com
- Policy tests
- It tests Terraform plans against policies written as behavior-driven development features and scenarios.Read 4 Oct 2026 · terraform-compliance.com
- Provider support
- The project says it works with any Terraform provider.Read 4 Oct 2026 · terraform-compliance.com
- Terraform input
- The tool requires a Terraform plan or state output as input and can also run against JSON-converted plan output.Read 4 Oct 2026 · terraform-compliance.com
- Terraform version support
- The overview says terraform-compliance supports Terraform versions newer than 0.12.Read 4 Oct 2026 · terraform-compliance.com
- Validation timing
- The project describes validating code before deployment and running checks in a pipeline or git hooks.Read 4 Oct 2026 · terraform-compliance.com
Plans and prices
Strong points and limits
Strong points
- Free MIT-licensed open-source project
- Works with any Terraform provider
- Readable BDD policy scenarios
- Supports pipelines and git hooks
- Offers Docker and pip installation
Limits
- Requires Terraform plan or state output
- pip installation requires Python 3.x
- Does not provide runtime enforcement
Who it suits
terraform-compliance suits developers and security teams who need readable Terraform policy checks before deployment. Separate policy repositories can be maintained by another team.
Verdict
terraform-compliance provides focused, pre-deployment policy testing for Terraform. Its readable scenarios and CI examples suit infrastructure teams, while runtime controls are outside its scope.
Where Specifiction places it
- IaC Security Scanners#11 of 167.2
- Infrastructure Testing Tools#20 of 287.2
- Infrastructure Policy as Code Tools#18 of 257.2