diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 746a676..492b559 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -79,6 +79,7 @@ - id: terraform_tfsec name: Terraform validate with tfsec description: Static analysis of Terraform templates to spot potential security issues. + require_serial: true entry: terraform_tfsec.sh language: script diff --git a/terraform_tfsec.sh b/terraform_tfsec.sh index 6c6ee25..c742f32 100755 --- a/terraform_tfsec.sh +++ b/terraform_tfsec.sh @@ -6,13 +6,13 @@ main() { parse_cmdline_ "$@" # propagate $FILES to custom function - tfsec_ "$ARGS" "$FILES" + tfsec_ "$ARGS" "${FILES[*]}" } tfsec_() { # consume modified files passed from pre-commit so that # tfsec runs against only those relevant directories - for file_with_path in $FILES; do + for file_with_path in ${FILES[*]}; do file_with_path="${file_with_path// /__REPLACED__SPACE__}" paths[index]=$(dirname "$file_with_path")