Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform_docs starting from 1.94.0 ignores --hook-config=--add-to-existing-file=false (our default behavior) #715

Closed
MaxymVlasov opened this issue Sep 9, 2024 · 1 comment · Fixed by #716
Labels

Comments

@MaxymVlasov
Copy link
Collaborator

MaxymVlasov commented Sep 9, 2024

Describe the bug

terraform-docs --output-mode="inject" --output-file=README.md md .

which is exactly what we run by default

terraform-docs --output-mode="$output_mode" --output-file="$output_file" $tf_docs_formatter $args ./ > /dev/null

by

repos:
  - repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: v1.94.2 # issue introduced in 1.94.0
    hooks:
      - id: terraform_docs

always updates/add terraform-docs section, as long as file exist.

This break your --add-to-existing-file setting, which by default set to false

How can we reproduce it?

testdir=$(mktemp -d)
cd $testdir
touch main.tf README.md
echo "
repos:
  - repo: https://github.com/antonbabenko/pre-commit-terraform
    rev: v1.94.2 # issue introduced in 1.94.0
    hooks:
      - id: terraform_docs
" > .pre-commit-config.yaml
git init
git add -A
pre-commit run

Workaround

  • if you on Linux (and you have no Mac users) - stick to v1.93.1
  • otherwise, stick to v1.92.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants