Security scanner for your Terraform code
open sourceMITself-hostablefree
tfsec is Aqua Security's static analysis scanner for Terraform code: it checks resources against hundreds of built-in rules for misconfigurations across the major cloud providers, evaluating HCL expressions, functions and module calls, with user-defined Rego policies and output as JSON, SARIF, JUnit, CSV or CheckStyle. In February 2023 Aqua announced that tfsec was joining Trivy: tfsec's engine became the basis of Trivy's IaC and misconfiguration scanning (trivy config), Aqua encourages tfsec users to move to Trivy and directs its engineering there, and tfsec's own last release was 1.28.14 in May 2025. It's MIT.
Problems it solves
- scan our Terraform code for insecure cloud settings like public S3 buckets before we apply it
- fail the CI build when a Terraform change opens a security group to the whole internet
- static analysis of Terraform modules, including remote modules, for cloud misconfigurations
- write our own Terraform security rules as Rego policies
- upload Terraform security findings to GitHub code scanning as SARIF
- what replaced tfsec now that Aqua moved Terraform scanning into Trivy
Features
- hundreds of built-in rules across AWS, Azure, Google Cloud and other providers
- scans local and remote modules
- evaluates HCL expressions, Terraform functions and relationships between resources
- compatible with the Terraform CDK
- user-defined Rego policies
- output: default, JSON, SARIF, CSV, CheckStyle, JUnit, text
- IDE plugins for JetBrains, VS Code and Vim
- Docker images and a GitHub Action (tfsec-pr-commenter-action)
Limitations
- No longer actively developed: Aqua directs its engineering to Trivy and asks tfsec users to migrate12
Capabilities
| Has a command line tool | plan not known |
|---|
Alternatives
The same job
These do what tfsec does.
- Checkov Prevent cloud misconfigurations and find vulnerabilities during build-time in infrastructure as code, container images and open source packages
- KICS Keeping Infrastructure as Code Secure
- Trivy Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more
- TFLint A Pluggable Terraform Linter
- DeepSource AI code review platform that combines static analysis with AI review agents
