-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
Add new hook for running terraform-docs which will replace content of README.md (using Python) #27
Add new hook for running terraform-docs which will replace content of README.md (using Python) #27
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.
Thanks for the PR. It looks pretty good, but I propose to make few customization to make it more flexible:
- Make filename
README.md
customizable via args. - Where
main.tf
comes from? Where it is used? Whymain.tf
? - Move
setup.py
and package files inside a folder (eg,terraform_docs_replace
) to not mix root of the repo. sed
command can be different between systems. Since this is already in Python I would recommend to use native Python methods and replacesed
.
Sure that sounds reasonable.
main.tf is the standard entrypoint for a Terraform module.
According to the docs setup.py has to stay at the root in order to get picked up by pip. Note: a single setup.py file will support any and all future pre-commit hooks written in Python. All you have to do is add a line to the
Makes sense |
Looks good. :) Could you also add a note to README for developers (not users) something like "It is possible to support any and all future pre-commit hooks written in Python. All you have to do is add a line to the console_scripts array in entry_points." |
Don't merge this yet. I'm not done with it. |
Actually, maybe I am. @antonbabenko if you're fine with leaving the call to |
Ready to merge. I'm done making changes unless there are more requested. |
Great! v1.8.0 has been released. Thanks @RothAndrew for the work! |
This is not clear - could you update the docs to explain this, @RothAndrew ? |
Adds a new hook called
terraform_docs_replace
which uses the documentation found at the top ofmain.tf
to recreate README.md. I'm open to suggestions on the name, I don't love it.Fix #17
I know this is going to probably come across as "going against the grain" a little bit, but I wanted to write it because this is how I've done all my Terraform documentation, and this seemed like the right place for it to live.
It's not super thoroughly tested, but from the testing that I have done it looks very promising. Switching to Python instead of a shell script actually gives better OS compatibility because it works anywhere Python works vs the bash scripts that only work on OS's in the Unix family. Also, we know Python is already installed because you need Python to run
pre-commit