Skip to content

Commit

Permalink
fix(terraform_docs): Suppress "terraform command not found" error m…
Browse files Browse the repository at this point in the history
…essage in case binary does not exist (#693)
  • Loading branch information
ponceps authored Aug 1, 2024
1 parent 2d7a2fb commit 6ff3572
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hooks/terraform_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ function terraform_docs_ {
IFS=";" read -r -a configs <<< "$hook_config"

local hack_terraform_docs
hack_terraform_docs=$(terraform version | sed -n 1p | grep -c 0.12) || true
local hack_terraform_docs=0
if [[ $(\command -V terraform 2> /dev/null) ]]; then
hack_terraform_docs=$(terraform version | sed -n 1p | grep -c 0.12) || true
fi

if [[ ! $(command -v terraform-docs) ]]; then
echo "ERROR: terraform-docs is required by terraform_docs pre-commit hook but is not installed or in the system's PATH."
Expand Down

0 comments on commit 6ff3572

Please sign in to comment.