Code styling
Last updated
Last updated
Use .editorconfig
: helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs. Include an .editorconfig
file in your repositories to maintain consistent whitespace and indentation.
Example .editorconfig
:
With Terraform configurations pre-commit
can be used to format and validate code, as well as to update documentation.
Use #
for comments. Avoid //
or block comments.
Example:
Section Headers: Delimit section headers in code with # -----
or ######
for clarity.
Example:
@todo: Document module versions, release, GH actions
is a framework for managing and maintaining multi-language pre-commit hooks. It is written in Python and is a powerful tool to do something automatically on a developer's machine before code is committed to a git repository. Normally, it is used to run linters and format code (see ).
Check out the to familiarize yourself with it, and existing repositories (eg, ) where this is used already.
is a tool that does the generation of documentation from Terraform modules in various output formats. You can run it manually (without pre-commit hooks), or use to get the documentation updated automatically.
Blog post by :