Skip to content

Commit

Permalink
Merge pull request #13 from mihirhasan/main - Adds support for Terras…
Browse files Browse the repository at this point in the history
…can -v option

Added support for Terrascan's -v option
  • Loading branch information
cesar-rodriguez committed Aug 2, 2021
2 parents 32ad3ce + bc78e73 commit 5d52e57
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ The action will only warn and not error when violations are found.
### `sarif_upload`
If this variable is included, a sarif file named terrascan.sarif will be generated with the results of the scan.

### `verbose`
If this variable is included, the scan will show violations with additional details (Rule Name/ID, Resource Name/Type, Violation Category)

## Example usage

```yaml
Expand All @@ -52,6 +55,7 @@ jobs:
iac_version: 'v14'
policy_type: 'aws'
only_warn: true
verbose: true
#sarif_upload: true
#non_recursive:
#iac_dir:
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ inputs:
sarif_upload:
description: 'if true a sarif file named terrascan.sarif will be generated with the results of the scan'
required: false
verbose:
description: ' will show violations with additional details (applicable for default output)'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -46,6 +49,8 @@ runs:
- ${{ inputs.config_path }}
- ${{ inputs.only_warn }}
- ${{ inputs.sarif_upload }}
- ${{ inputs.verbose }}

branding:
icon: 'code'
color: 'blue'
6 changes: 5 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ echo "INPUT_POLICY_PATH=${INPUT_POLICY_PATH}"
echo "INPUT_SKIP_RULES=${INPUT_SKIP_RULES}"
echo "INPUT_CONFIG_PATH=${INPUT_CONFIG_PATH}"
echo "INPUT_SARIF_UPLOAD=${INPUT_SARIF_UPLOAD}"
echo "INPUT_VERBOSE=${INPUT_VERBOSE}"


# Creating arguments for terrascan
args=""
Expand Down Expand Up @@ -38,7 +40,9 @@ fi
if [ "x${INPUT_CONFIG_PATH}" != "x" ]; then
args="${args} -c ${INPUT_CONFIG_PATH}"
fi

if [ ${INPUT_VERBOSE} == true ]; then
args="${args} -v"
fi
# Executing terrascan
echo "Executing terrascan as follows:"
echo "terrascan scan ${args}"
Expand Down

0 comments on commit 5d52e57

Please sign in to comment.