Skip to content

Commit

Permalink
feat: Add PATH outputs when TFLint found any problem (antonbabenko#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxymVlasov authored Sep 30, 2021
1 parent 3bdcf51 commit ce02cd1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion terraform_tflint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,18 @@ tflint_() {
path_uniq="${path_uniq//__REPLACED__SPACE__/ }"

pushd "$path_uniq" > /dev/null
tflint "${ARGS[@]}"
TFLINT_MSG=$(
tflint "${ARGS[@]}" 2>&1 ||
echo >&2 -e "\033[1;31m\nERROR in ./$path_uniq/:\033[0m" &&
tflint "${ARGS[@]}" # Print TFLint error with PATH
)

# Print checked PATH if TFLint have any messages
if [ ! -z "$TFLINT_MSG" ]; then
echo -e "\n./$path_uniq/:"
echo "$TFLINT_MSG"
fi

popd > /dev/null
done
}
Expand Down

0 comments on commit ce02cd1

Please sign in to comment.