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:
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:
.. tf:resource:: foo_resource.bar
Tip
For details about provided directives, see Directives.
Then cross-reference your definitions with some of our roles:
You should really check out :rf:resource:`foo_resource.bar`.
Tip
for details about supported roles, see Roles.
Sphinx-Terraform is