Semgrep scans OpenTofu .tofu files as Terraform
Introduced 2026-07-22 · score 0.94
HOW TO USE IT
When scanning a repository with OpenTofu `.tofu` files, run a recursive Semgrep scan with `p/terraform`; Semgrep 1.171.0 detects and scans `.tofu` files as Terraform without extra configuration.
semgrep scan --config p/terraform .WHY THIS HELPS
Scan a repository containing OpenTofu files with recursive scans or Terraform rulesets.
REQUIREMENTS AND LIMITATIONS
- Version: 1.171.0
- TARGETS (`.`): Files or folders to scan; Semgrep defaults to the current working directory.
- --config (`p/terraform`) (required): Select a Semgrep Registry ruleset by name.
- Prerequisite: Use Semgrep 1.171.0 or later for the documented `.tofu` automatic detection change.
FIRST-PARTY EVIDENCE
Check the installed version and the source before using it. Entry JSON