Files
terraform-docs/docs/how-to/insert-output-to-file.md
2025-04-02 13:54:17 -04:00

952 B

title, description, menu, weight, toc
title description menu weight toc
Insert Output To File How to insert generated terraform-docs output to file
docs
parent
how-to
205 false

Since v0.12.0

Generated output can be inserted directly into the file. There are two modes of insertion: inject (default) or replace. Take a look at [output] configuration for all the details.

terraform-docs markdown table --output-file README.md --output-mode inject /path/to/module

{{< alert type="info" >}} --output-file can be relative to module path or an absolute path in filesystem. {{< /alert>}}

$ pwd
/path/to/module

$ tree .
.
├── docs
│   └── README.md
├── ...
└── main.tf

# this works, relative path
$ terraform-docs markdown table --output-file ./docs/README.md .

# so does this, absolute path
$ terraform-docs markdown table --output-file /path/to/module/docs/README.md .

[output]: {{< ref "output" >}}