Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
tfsec is a fast static analyser for Terraform that evaluates variables and modules rather than matching text. Aqua Security now folds its engine into Trivy, so new work belongs there.

What Is tfsec?
tfsec is a static analysis tool built specifically for Terraform. It parses HCL, resolves variables and module inputs where it can, and checks the resulting configuration against several hundred rules covering AWS, Azure, Google Cloud, Kubernetes, and general Terraform practice. It was created by Liam Galvin and later adopted by Aqua Security, and it is written in Go and distributed as a single binary.
Its reputation rests on two things: it is very fast, and because it evaluates rather than pattern-matches, it understands configurations where a security-relevant value is set through a variable or passed into a module.
tfsec ./infrastructure --minimum-severity HIGH --format sarif --out results.sarif
Findings carry a readable check identifier such as aws-s3-enable-bucket-encryption or azure-storage-default-action-deny, a severity, the exact file and line, a short explanation of the risk, and a link to documentation showing the corrected configuration. Those descriptive identifiers replaced the older numeric AWS001 style in version 1.0, released in late 2021, and remain considerably easier to read in a pull request comment than a numbered rule.
Useful options are few: --soft-fail reports without breaking the build during adoption, --exclude-downloaded-modules avoids drowning in findings from community modules you did not write, and --config-file holds persistent settings so they are not buried in pipeline YAML.
The evaluation step is what separates it from a text scanner. Given a module invoked with encrypted = var.encrypt_volumes, tfsec follows the variable to its default or to the value supplied by the calling module, and judges the configuration that will actually be created. Where the value genuinely cannot be determined, it says so rather than guessing, which keeps the report honest.
Suppression is an inline comment above the resource:
# tfsec:ignore:aws-s3-enable-bucket-logging
# tfsec:ignore:aws-vpc-no-public-ingress-sgr:exp:2026-03-31
The expiry suffix is a small feature worth copying wherever you find it. An ignore with a date stops being an ignore when the date passes, which converts a permanent silent exception into a decision that comes back for review. Most suppression mechanisms lack this, and most suppression lists grow forever as a result.
Aqua Security announced that tfsec is being consolidated into Trivy, which now contains the same misconfiguration engine and rule set as part of a scanner that also covers container images, filesystems, dependencies, secrets, licences, and Kubernetes clusters. tfsec itself is in maintenance mode: it still works, but new rules and new cloud resource coverage land in Trivy.
The practical consequences:
trivy config ./infrastructure rather than tfsec. The checks are the same lineage and the tool is actively developed.Two limits apply equally to its successor. First, tfsec reads source files, not plan output, so a value that only resolves at plan time — from a data source, a remote state lookup, or a computed expression — may be invisible. Checkov’s ability to scan a JSON plan covers that gap, and teams with heavily parameterised modules should run both a source scan and a plan scan.
Second, static analysis of code says nothing about the running estate. Resources created in the console, changed during an incident, or deployed by a pipeline that bypasses review never appear in the repository and never get scanned. That is the job of cloud security posture management, and the two are complements rather than alternatives.
At Privia Security, we assess both the infrastructure code and the deployed configuration behind it in our cloud security services.
For an existing pipeline that works, there is no urgency to change. For anything new, use Trivy’s configuration scanning instead, since Aqua Security is consolidating the tfsec engine into Trivy and new rules and cloud resource coverage land there. Trivy understands the same inline ignore comments, so migrating an existing setup is usually a matter of changing the command and the output format.
tfsec is Terraform-specific and evaluates HCL, including variables and module inputs, which makes it fast and accurate on Terraform specifically. Checkov supports many more formats, has a graph engine for reasoning about relationships between resources, and can scan a resolved Terraform plan in JSON, which catches values that source analysis cannot see. Many teams run a source scan and a plan scan together.
It makes the suppression temporary. After the date passes, tfsec stops honouring the ignore and the finding reappears, forcing a fresh decision rather than letting an exception persist silently for years. It is a small feature with a large effect on how suppression lists age, and it is worth applying the same discipline in tools that do not enforce it automatically.
No. It analyses Terraform source files in your repository and knows nothing about what actually exists in your cloud accounts. Resources created through the console, modified manually during an incident, or deployed outside the pipeline are invisible to it. Pair infrastructure as code scanning with cloud security posture management if you want assurance about the running environment.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.