Skip to content

Commit

Permalink
docs(terraform): make jq default (#5462)
Browse files Browse the repository at this point in the history
* docs(terraform): make jq default

* Add jq is a prereq
  • Loading branch information
tsmithv11 authored Aug 21, 2023
1 parent a456476 commit e5e6118
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions docs/7.Scan Examples/Terraform Plan Scanning.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
```
Expand Down

0 comments on commit e5e6118

Please sign in to comment.