Skip to content

Commit 5d52e57

Browse files
author
Cesar Rodriguez
authored
Merge pull request #13 from mihirhasan/main - Adds support for Terrascan -v option
Added support for Terrascan's -v option
2 parents 32ad3ce + bc78e73 commit 5d52e57

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ The action will only warn and not error when violations are found.
3232
### `sarif_upload`
3333
If this variable is included, a sarif file named terrascan.sarif will be generated with the results of the scan.
3434

35+
### `verbose`
36+
If this variable is included, the scan will show violations with additional details (Rule Name/ID, Resource Name/Type, Violation Category)
37+
3538
## Example usage
3639

3740
```yaml
@@ -52,6 +55,7 @@ jobs:
5255
iac_version: 'v14'
5356
policy_type: 'aws'
5457
only_warn: true
58+
verbose: true
5559
#sarif_upload: true
5660
#non_recursive:
5761
#iac_dir:

action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ inputs:
3232
sarif_upload:
3333
description: 'if true a sarif file named terrascan.sarif will be generated with the results of the scan'
3434
required: false
35+
verbose:
36+
description: ' will show violations with additional details (applicable for default output)'
37+
required: false
3538
runs:
3639
using: 'docker'
3740
image: 'Dockerfile'
@@ -46,6 +49,8 @@ runs:
4649
- ${{ inputs.config_path }}
4750
- ${{ inputs.only_warn }}
4851
- ${{ inputs.sarif_upload }}
52+
- ${{ inputs.verbose }}
53+
4954
branding:
5055
icon: 'code'
5156
color: 'blue'

entrypoint.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ echo "INPUT_POLICY_PATH=${INPUT_POLICY_PATH}"
1111
echo "INPUT_SKIP_RULES=${INPUT_SKIP_RULES}"
1212
echo "INPUT_CONFIG_PATH=${INPUT_CONFIG_PATH}"
1313
echo "INPUT_SARIF_UPLOAD=${INPUT_SARIF_UPLOAD}"
14+
echo "INPUT_VERBOSE=${INPUT_VERBOSE}"
15+
1416

1517
# Creating arguments for terrascan
1618
args=""
@@ -38,7 +40,9 @@ fi
3840
if [ "x${INPUT_CONFIG_PATH}" != "x" ]; then
3941
args="${args} -c ${INPUT_CONFIG_PATH}"
4042
fi
41-
43+
if [ ${INPUT_VERBOSE} == true ]; then
44+
args="${args} -v"
45+
fi
4246
# Executing terrascan
4347
echo "Executing terrascan as follows:"
4448
echo "terrascan scan ${args}"

0 commit comments

Comments
 (0)