Skip to content

Commit

Permalink
fix: TFSec outputs the same results multiple times (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxymVlasov committed Oct 14, 2021
1 parent 3ae5eb0 commit 71f7c34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions terraform_tfsec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 71f7c34

Please sign in to comment.