diff --git a/README.md b/README.md index b49bcb7..ef3dd57 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,12 @@ The action requires the https://github.com/actions/checkout before to download t * `tfsec_actions_comment` - (Optional) Whether or not to comment on GitHub pull requests. Defaults to `true`. * `tfsec_actions_working_dir` - (Optional) Terraform working directory location. Defaults to `'.'`. +* `tfsec_config_file` - (Optional) The name of the [config file](https://tfsec.dev/docs/config/) used to override various tfsec configurations. Ignored if `tfsec_exclude` is also specified. * `tfsec_exclude` - (Optional) Provide checks via `,` without space to exclude from run. No default * `tfsec_version` - (Optional) Specify the version of tfsec to install. Defaults to the latest * `tfsec_output_format` - (Optional) The output format: default, json, csv, checkstyle, junit, sarif (check `tfsec` for an extensive list) * `tfsec_output_file` - (Optional) The name of the output file - + ## Outputs None diff --git a/action.yml b/action.yml index c124bbb..48a386b 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,9 @@ inputs: description: 'Terraform working directory.' required: false default: '.' + tfsec_config_file: + description: 'The name of the config file used to override various tfsec configurations' + required: false tfsec_exclude: description: 'Provide checks via , without space to exclude from run' required: false diff --git a/entrypoint.sh b/entrypoint.sh index 6112420..e12d327 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,6 +16,8 @@ fi if [[ -n "$INPUT_TFSEC_EXCLUDE" ]]; then TFSEC_OUTPUT=$(/go/bin/tfsec ${TFSEC_WORKING_DIR} --no-colour -e "${INPUT_TFSEC_EXCLUDE}" ${INPUT_TFSEC_OUTPUT_FORMAT:+ -f "$INPUT_TFSEC_OUTPUT_FORMAT"} ${INPUT_TFSEC_OUTPUT_FILE:+ --out "$INPUT_TFSEC_OUTPUT_FILE"}) +elif [[ -n "$INPUT_TFSEC_CONFIG_FILE" ]]; then + TFSEC_OUTPUT=$(/go/bin/tfsec ${TFSEC_WORKING_DIR} --no-colour --config-file "${INPUT_TFSEC_CONFIG_FILE}" ${INPUT_TFSEC_OUTPUT_FORMAT:+ -f "$INPUT_TFSEC_OUTPUT_FORMAT"} ${INPUT_TFSEC_OUTPUT_FILE:+ --out "$INPUT_TFSEC_OUTPUT_FILE"}) else TFSEC_OUTPUT=$(/go/bin/tfsec ${TFSEC_WORKING_DIR} --no-colour ${INPUT_TFSEC_OUTPUT_FORMAT:+ -f "$INPUT_TFSEC_OUTPUT_FORMAT"} ${INPUT_TFSEC_OUTPUT_FILE:+ --out "$INPUT_TFSEC_OUTPUT_FILE"}) fi