Sphinx-Terraform

A Sphinx extension for documenting Terraform modules.

Sphinx-Terraform is simple to use and integrate smoothly with your Terraform codebase.

Programs must be written for people to read, and only incidentally for machines to execute.

SICP

Code can become reusable when it is clearly visible, searchable and referenceable. Sphinx-Terraform will help

  • make reusable modules that application developers will find easier to find, understand and use, thus reducing bugs, support time and toil;

  • show value to stakeholders, since Infrastructure as Code is an abstract and obscure topic for non-practitioners;

  • promote knowledge and foster a community spirit around your code;

  • keep track of why things work the way they do.

Quick start

Install Sphinx-Terraform:

pip install -U sphinx-terraform

Enable Sphinx-Terraform in your conf.py (conf), and configure where to find the Terraform files:

conf.py
extensions = [
    # other extensions ...
    "sphinx_terraform"
]

terraform_sources = "../relativeto/docsfolder/terraform"

Tip

For details about configuration, see Configuration.

Place your Terraform documentation within your RestructuredText source files using one of our directive:

some_documentation.rst
.. tf:resource:: foo_resource.bar

Tip

For details about provided directives, see Directives.

Then cross-reference your definitions with some of our roles:

some_other_documentation.rst
You should really check out :rf:resource:`foo_resource.bar`.

Tip

for details about supported roles, see Roles.

Sphinx-Terraform is

Indices and references

Important

Terraform and the Terraform Logo are trademarks of HashiCorp. Sphinx-Terraform is not associated with HashiCorp.