Demo of using custom policy with terraform
trivy config --config-policy=. --severity=CRITICAL --namespaces=user .
2023-05-11T17:08:28.108-0600 INFO Misconfiguration scanning is enabled
2023-05-11T17:08:28.908-0600 INFO Detected config files: 1
main.tf (terraform)
Tests: 1 (SUCCESSES: 0, FAILURES: 1, EXCEPTIONS: 0)
Failures: 1 (CRITICAL: 1)
CRITICAL: Rego policy rule: user.foobar.ABC001.deny
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Bad buckets are bad because they are not good.
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
main.tf:2
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 resource "aws_s3_bucket" "my-bucket" {
2 [ bucket = "evil"
3 }
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────