header-from
Since v0.10.0
Relative path to a file to extract header for the generated output from. Supported
file formats are .adoc, .md, .tf, .tofu, and .txt.
The whole file content is being extracted as module header when extracting from
.adoc, .md, or .txt.
To extract header from .tf or .tofu file you need to use following javascript, c, or java
like multi-line comment.
/**
* # Main title
*
* Everything in this comment block will get extracted.
*
* You can put simple text or complete Markdown content
* here. Subsequently if you want to render AsciiDoc format
* you can put AsciiDoc compatible content in this comment
* block.
*/
resource "foo" "bar" { ... }
This comment must start at the immediate first line of the
.tf or .tofu file
before any resource, variable, module, etc.
terraform-docs will never alter line-endings of extracted header text and will assume
whatever extracted is intended as is. It’s up to you to apply any kind of Markdown
formatting to them (i.e. adding
<SPACE><SPACE> at the end of lines for break, etc.)
Options
Available options with their default values.
header-from: main.tf
Examples
Read header.md to extract header:
header-from: header.md
Read docs/.header.md to extract header:
header-from: "docs/.header.md"