Configure Trivy to evaluate Terraform IaC with custom Rego checks and run filesystem scans with license and secret detection enabled

domain: trivy.dev · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Write custom check logic in Rego under a policy directory, following Trivy's check metadata schema (id, title, severity, input selector).
  2. Run trivy config --config-check <path-to-custom-checks-dir> --namespaces <your-namespace> <iac-dir> to evaluate Terraform/CloudFormation/Kubernetes manifests against both built-in and custom checks.
  3. Reference any external allow/deny lists your custom checks need with the --data <dir> flag.
  4. Run trivy fs --scanners vuln,misconfig,secret,license <path> to combine dependency vulnerability, misconfiguration, secret, and license scanning of a repository in one pass.
  5. Persist the merged configuration (policy, data, and namespaces entries) in a trivy.yaml file so local runs and CI invocations stay consistent, then gate CI with --exit-code and a severity threshold.

Known gotchas

Related routes

Scan IaC and container images together using Trivy in a CI pipeline
aquasecurity.github.io/trivy · 6 steps · unrated
Run a Trivy scan across image, filesystem, and config targets and apply an ignore policy
aquasecurity.github.io/trivy · 6 steps · unrated
Scan Terraform and Kubernetes IaC files with Checkov and output SARIF for GitHub code scanning
checkov.io · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans