- Home
- IaC Security Scanners
- terraform-compliance
terraform-compliance
What it is
terraform-compliance is a free, open-source framework for testing Terraform infrastructure code against security and compliance policies. It reads Terraform plan or state output, including plans converted to JSON, and checks them against behavior-driven feature files. 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 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 available for private repositories. Installation is documented through pip, which requires Python 3.x, or Docker. CI/CD examples cover CircleCI and GitHub Actions. Controls include turning failures into warnings, failing when steps skip, case-sensitive matching, and resource exclusion. The project is distributed under the MIT license and supports policy testing, admission control, and reporting, but not runtime enforcement.
For and against
For
- Free MIT-licensed open source
- BDD-style policy feature files
- Supports any Terraform provider
- Runs in pipelines and git hooks
- Includes CircleCI and GitHub Actions examples
Against
- Requires Terraform plan or state input
- pip installation requires Python 3.x
- Supports Terraform versions newer than 0.12
- No runtime enforcement
The verdict
terraform-compliance provides readable policy testing for Terraform before deployment and within delivery workflows. Its open-source licensing and CI integrations make it suitable for teams formalizing infrastructure checks.
Who it suits
terraform-compliance suits developers and security teams writing readable Terraform policy checks. It also fits organizations keeping policy features in a separate repository or running validation in CI/CD.
Plans and prices
terraform-compliance
Open-source Terraform compliance testing framework
Read 4 Oct 2026 · terraform-compliance.com
On the record
- 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 · read 4 Oct 2026
- CI integrations
- The documentation includes CI/CD examples for CircleCI and GitHub Actions.terraform-compliance.com · read 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 · read 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 · read 4 Oct 2026
- Install options
- The documentation provides installation through pip and Docker; pip installation requires Python 3.x.terraform-compliance.com · read 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 · read 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 · read 4 Oct 2026
- Policy tests
- It tests Terraform plans against policies written as behavior-driven development features and scenarios.terraform-compliance.com · read 4 Oct 2026
- Provider support
- The project says it works with any Terraform provider.terraform-compliance.com · read 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 · read 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 · read 4 Oct 2026
- Terraform version support
- The overview says terraform-compliance supports Terraform versions newer than 0.12.terraform-compliance.com · read 4 Oct 2026
- Validation timing
- The project describes validating code before deployment and running checks in a pipeline or git hooks.terraform-compliance.com · read 4 Oct 2026