From e5e611861c2a8c18e714fa35dc0a6e53b62d819c Mon Sep 17 00:00:00 2001 From: Taylor <28880387+tsmithv11@users.noreply.github.com> Date: Mon, 21 Aug 2023 08:02:44 -0700 Subject: [PATCH] docs(terraform): make jq default (#5462) * docs(terraform): make jq default * Add jq is a prereq --- docs/7.Scan Examples/Terraform Plan Scanning.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/docs/7.Scan Examples/Terraform Plan Scanning.md b/docs/7.Scan Examples/Terraform Plan Scanning.md index cf255095134..cb60990cec6 100644 --- a/docs/7.Scan Examples/Terraform Plan Scanning.md +++ b/docs/7.Scan Examples/Terraform Plan Scanning.md @@ -12,22 +12,16 @@ Checkov supports the evaluation of policies on resources declared in `.tf` files ### Example +The example below creates a Terraform Plan JSON file and scans it using Checkov. It uses `jq` which must be installed beforehand and leads to better formatted outputs and results. It is not explicitly required for plan scanning. + ```json terraform init terraform plan --out tfplan.binary -terraform show -json tfplan.binary > tfplan.json +terraform show -json tfplan.binary | jq > tfplan.json checkov -f tfplan.json ``` -Note: The Terraform show output file `tf.json` will be a single line. For that reason Checkov will report all findings as line number 0. -If you have installed jq, you can convert a JSON file into multiple lines making it easier to read the scan result. - -```json -terraform show -json tfplan.binary | jq '.' > tfplan.json - -checkov -f tfplan.json -``` The output would look like: ```