Skip to content

Commit

Permalink
fix: analyse all folders with tflint and don't stop on first execution (
Browse files Browse the repository at this point in the history
  • Loading branch information
bmbferreira authored Dec 8, 2021
1 parent 141f815 commit 7c6ad7c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions terraform_tflint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,24 @@ tflint_() {

((index += 1))
done

set +e
tflint_final_exit_code=0
for path_uniq in $(echo "${paths[*]}" | tr ' ' '\n' | sort -u); do
path_uniq="${path_uniq//__REPLACED__SPACE__/ }"
pushd "$path_uniq" > /dev/null

# Print checked PATH **only** if TFLint have any messages
# shellcheck disable=SC2091 # Suppress error output
$(tflint "${ARGS[@]}" 2>&1) 2> /dev/null || {
$(tflint "${ARGS[@]}" $path_uniq 2>&1) 2> /dev/null || {
echo >&2 -e "\033[1;33m\nTFLint in $path_uniq/:\033[0m"
tflint "${ARGS[@]}"
tflint "${ARGS[@]}" $path_uniq
}

popd > /dev/null
local exit_code=$?
if [ $exit_code != 0 ]; then
tflint_final_exit_code=$exit_code
fi
done
set -e
exit $tflint_final_exit_code
}

# global arrays
Expand Down

0 comments on commit 7c6ad7c

Please sign in to comment.