Code styling

  • Examples and Terraform modules should contain documentation explaining features and how to use them.

  • All links in README.md files should be absolute to make Terraform Registry website show them correctly.

  • Documentation may include diagrams created with mermaid and blueprints created with cloudcraft.co.

  • Use Terraform pre-commit hooks to make sure that the code is valid, properly formatted, and automatically documented before it is pushed to git and reviewed by humans.

Documentation

Automatically generated documentation

pre-commit 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 supported hooks).

With Terraform configurations pre-commit can be used to format and validate code, as well as to update documentation.

Check out the pre-commit-terraform repository to familiarize yourself with it, and existing repositories (eg, terraform-aws-vpc) where this is used already.

terraform-docs

terraform-docs 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 pre-commit-terraform hooks to get the documentation updated automatically.

@todo: Document module versions, release, GH actions

Resources

Last updated