-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
feat(terraform_docs
): Add terraform-docs
default markers support and describe how to migrate to them
#609
feat(terraform_docs
): Add terraform-docs
default markers support and describe how to migrate to them
#609
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While code in hooks/terraform_docs.sh
looks decent per se, the PR looks to be a mess of superfluous files local to contributor 🤔
set-up for test with no README remove lock file - not needed set-up to test adding to existing README restore README to original
WIP struggling with bash variable scope refactor perl command to allow variable expansion working hook, needs tidy up
This reverts commit da139e3.
df49658
to
fd91685
Compare
Yep, it's still WIP. Better now, but needs a little tidy up before review. I will hopefully finish this tomorrow |
@MaxymVlasov this is ready for review now. Thank you |
Co-authored-by: George L. Yermulnik <yz@yz.kiev.ua>
@yermulnik @MaxymVlasov thanks for the review. Please take another look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Leaving this to @MaxymVlasov to also review and merge if he's fine with the change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, we will switch to tf-docs default markers in v2.0
terraform_docs
): Add terraform-docs
default markers support and describe how to migrate to them
# [1.86.0](v1.85.0...v1.86.0) (2023-12-21) ### Features * **`terraform_docs`:** Add `terraform-docs` default markers support and describe how to migrate to them ([#609](#609)) ([4a0e1fe](4a0e1fe))
This PR is included in version 1.86.0 🎉 |
Thanks for a great contribution experience everyone! |
I just found this: https://github.com/terraform-docs/terraform-docs/#pre-commit-hook Can you offer any comparison between the two @antonbabenko ? |
Wow, didn't know that they have hooks. As far as I see, https://github.com/terraform-docs/terraform-docs/#pre-commit-hook was added 2021-05-19 in 0.12.0, when First of all, example in README repos:
- repo: https://github.com/terraform-docs/terraform-docs
rev: "v0.17.0"
hooks:
- id: terraform-docs-go
args: ["markdown", "table", "--output-file", "README.md", "./mymodule/path"] just not works, if, ofc, you want to add - id: terraform-docs-go
args: ["markdown", "table", "--output-file", "README.md", "./mymodule/path"]
- id: terraform-docs-go
args: ["markdown", "table", "--output-file", "README.md", "./mymodule/path2"]
....
- id: terraform-docs-go
args: ["markdown", "table", "--output-file", "README.md", "./mymodule/pathN"] And I don't get how to make work repos:
- repo: https://github.com/terraform-docs/terraform-docs
rev: "v0.17.0"
hooks:
- id: terraform-docs-go with default So far, I can say that |
# [1.86.0](antonbabenko/pre-commit-terraform@v1.85.0...v1.86.0) (2023-12-21) ### Features * **`terraform_docs`:** Add `terraform-docs` default markers support and describe how to migrate to them ([#609](antonbabenko/pre-commit-terraform#609)) ([9721e3b](antonbabenko/pre-commit-terraform@9721e3b))
Put an
x
into the box if that apply:Description of your changes
Allow users to switch to the standard insertion markers used by terraform-docs, to enable CI jobs to check that docs have been updated.
How can we test changes
Based on this suggestion for testing hooks: #25 (comment)
Add the following to the pre-commit config:
Add a new file
outputs.tf
:Stage the pre-commit config and the new outputs.tf file:
git add .pre-commit-config.yaml outputs.tf
Using the existing README.md as a target:
pre-commit run -a
should add the terraform docs between the existing markerspre-commit run -a
should create the file as normalpre-commit run -a
should add the terraform docs as normal--hook-config=--use_standard_markers=true
, andgit add -u
pre-commit run -a
should create the file as normal, but with different markersgit add README.md
terraform-docs markdown --output-file=README.md .
git diff
)For completeness, repeat the standard markers test for insertion between existing markers, and appending to an existing file with no markers (or check by code inspection).