antonbabenko / pre-commit-terraform

pre-commit git hooks to take care of Terraform configurations πŸ‡ΊπŸ‡¦
MIT License
3.16k stars 535 forks source link

terraform: command not found #445

Closed WurmD closed 1 year ago

WurmD commented 1 year ago

Describe the bug

After following the README.md for MacOS, and running pre-commit run -a we get

terraform: command not found

Does terraform require separate installation, and thus a mention in the README.md saying just that? (if not even the actual brew commands)

How can we reproduce it?

brew install pre-commit terraform-docs tflint tfsec checkov terrascan infracost tfupdate minamijoyo/hcledit/hcledit jq
DIR=~/.git-template
git config --global init.templateDir ${DIR}
pre-commit init-templatedir -t pre-commit ${DIR}
git init
cat <<EOF > .pre-commit-config.yaml
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
  rev: <VERSION> # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
  hooks:
    - id: terraform_fmt
    - id: terraform_docs
EOF
pre-commit run -a

Environment information

Darwin OM-C02ZQ84NMD6T 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64 x86_64
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21)
pre-commit 2.20.0
bash: line 3: terraform: command not found
python SKIPPED
Python 3.10.8
checkov 2.2.15
terraform-docs version v0.16.0 darwin/amd64
terragrunt SKIPPED
terrascan version: v1.16.0
TFLint version 0.42.2
+ ruleset.terraform (0.2.1-bundled)
tfsec v1.28.1
tfupdate 0.6.7
hcledit 0.2.6
file content ```bash repos: - repo: https://github.com/antonbabenko/pre-commit-terraform rev: # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases hooks: - id: terraform_fmt - id: terraform_docs ```
yermulnik commented 1 year ago

I guess this is implied that terraform is required for people who work on creating/updating Terraform code πŸ˜‰ Please see https://developer.hashicorp.com/terraform/downloads on how to install Terraform.

Also please feel free to contribute by creating PR to README with respective statement that terraform binary is required for some of pre-commit-terraform hooks. Thanks.

MaxymVlasov commented 1 year ago

No way, @antonbabenko we totally need to return first line from https://github.com/antonbabenko/pre-commit-terraform/tree/v1.52.0#1-install-dependencies ! :D

WurmD commented 1 year ago

That's actually great @MaxymVlasov :), it's funny for those who know, and informative for the very much existing large part of the population that does not know

Take my example, I have no clue what terraform is, and I still need to have this pre-commit-hook running in the repo I'm using at work, ergo, this issue

Just to underline my point, I do not know what terraform is, and I will not use it, ergo I will not learn what it is, and yet, this issue

antonbabenko commented 1 year ago

This issue has been resolved in version 1.76.1 :tada: