-
QuestionBasically, I am trying to deny all changes with destroy operations using trvy custom checks. This is my code, and so far I only get an acknowledgement that the rego file is taken by trivy.
The command I have used is:
TargetGit Repository ScannerMisconfiguration Output FormatJSON ModeStandalone Operating SystemLinux Versionv0.65.0 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @Afsalmc ! To scan Terraform Plan as JSON, you must enable the JSON scanner. ❯ trivy conf plan.json --misconfig-scanners json --namespaces user --config-check deny_deletion.rego -q --table-mode detailed
plan.json (json)
Tests: 1 (SUCCESSES: 0, FAILURES: 1)
Failures: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 1)
(CRITICAL): Deletion of resource 'aws_s3_bucket.example' (type: aws_s3_bucket) is not allowed
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Prevents deletion of any resources in a Terraform plan
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Also, for the namespaces flag, you should pass the package prefix BTW, you check that the resource is being created, not deleted: |
Beta Was this translation helpful? Give feedback.
Hi @Afsalmc !
To scan Terraform Plan as JSON, you must enable the JSON scanner.