cfn-nag vs terraform-compliance
cfn-nag
github.comterraform-compliance
terraform-compliance.comSide by side
| Figure | cfn-nag | terraform-compliance |
|---|---|---|
| Price from | Free | Free |
| Free plan | Yes | Yes |
| Free trial | — | — |
| Open source | — | — |
| macOS | Yes | — |
| Linux | Yes | Yes |
| Self-hosted | Yes | Yes |
| Plans published | 1 | 1 |
| Spec score · Infrastructure Testing Tools | 8.0 (#9) | 7.2 (#20) |
| Spec score · IaC Security Scanners | 8.0 (#7) | 7.2 (#11) |
| License | The project uses the MIT License, which grants permission to use, copy, modify, merge, publish, distribute, sublicense, and sell the software subject to its terms. | The maker’s site says the project is open source, free to use, and distributed under the MIT license. |
| Purpose | cfn-nag scans CloudFormation templates for patterns that may indicate insecure infrastructure. | terraform-compliance is a lightweight, security- and compliance-focused test framework for negative testing of infrastructure as code written with Terraform. |
Plans
In their own words
cfn-nag
cfn-nag is free, MIT-licensed software that scans AWS CloudFormation templates for patterns that may indicate insecure infrastructure. It checks for overly permissive IAM policies and security-group rules, disabled access logging or encryption, and password literals. The scanner accepts JSON, .template, YAML, and YML files, and recursively processes subdirectories when given a directory. Results print to standard output, with JSON output available; failures return a non-zero exit code while warnings return success. Installation is documented through RubyGems and Homebrew, with Ruby 2.5 or later required for gem installation. A Dockerfile and Docker Hub image are provided. cfn-nag can run in GitHub Actions and AWS CodePipeline. Profiles, deny lists, per-resource suppressions, and custom rules support policy tailoring. Static analysis needs supplied parameter values to assess them and does not inspect false Fn::If outcomes by default.
terraform-compliance
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.