Skip to content

Commit

Permalink
BAH-1566 | refactor. show colored output of scan results
Browse files Browse the repository at this point in the history
Co-authored-by: Umair Fayaz <[email protected]>
  • Loading branch information
mohan-13 and umair-fayaz committed Apr 20, 2022
1 parent e8bc2cd commit b24d036
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions terrascan/terrascan.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

# Terrascan scan and save output to scan_results
scan_results="$(terrascan scan --config-path terrascan/terrascan-config.yaml --iac-type terraform)"
scan_results="$(terrascan scan --config-path terrascan/terrascan-config.yaml --iac-type terraform --use-colors t)"

# Get scan summary from scan_results
scan_summary=$(echo "$scan_results" | sed -n -e '/Scan Summary -/,$p')
scan_summary=$(echo "$scan_results" | sed -n -e '/Scan Summary -/,$p' | sed -r "s/[[:cntrl:]]\[([0-9]{1,3};)*[0-9]{1,3}m//g")

#Extract values from scan_summary
low_level_violations=$(grep "Low" <<< "$scan_summary" | grep -o -E "[0-9]+")
Expand Down

0 comments on commit b24d036

Please sign in to comment.