mirror of
https://github.com/terraform-docs/terraform-docs.git
synced 2026-03-27 04:48:33 +07:00
Customize content with individual sections output
Generated content can be customized further away with `content` in configuration.
If the `content` is empty the default orders of section is used. `content` is a
Go template with following additional variables:
- `{{ .Header }}`
- `{{ .Footer }}`
- `{{ .Inputs }}`
- `{{ .Modules }}`
- `{{ .Outputs }}`
- `{{ .Providers }}`
- `{{ .Requirements }}`
- `{{ .Resources }}`
```yaml
content: |-
Any arbitrary text can be placed anywhere in the content
{{ .Header }}
and even in between sections
{{ .Providers }}
and they don't even need to be in the default order
{{ .Outputs }}
{{ .Inputs }}
```
These variables are the generated output of individual sections in the selected
formatter. For example `{{ .Inputs }}` is Markdown Table representation of inputs
when formatter is set to `markdown table` and AsciiDoc Document representation
when formatter is set to `asciidoc document` and so on.
Compatible formats for customized content are:
- `asciidoc document`
- `asciidoc table`
- `markdown document`
- `markdown table`
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
# # terraform-docs version constraints for execution
|
||||
# # more information: https://terraform-docs.io/user-guide/configuration/#version
|
||||
# # see: https://terraform-docs.io/user-guide/configuration/#version
|
||||
# version: ">= 0.10, < 0.12"
|
||||
|
||||
# see: https://terraform-docs.io/user-guide/configuration/#formatters
|
||||
formatter: markdown table
|
||||
|
||||
header-from: doc.txt
|
||||
footer-from: footer.md
|
||||
|
||||
# see: https://terraform-docs.io/user-guide/configuration/#sections
|
||||
sections:
|
||||
show:
|
||||
- header
|
||||
@@ -15,6 +16,23 @@ sections:
|
||||
- modules
|
||||
- footer
|
||||
|
||||
# # see: https://terraform-docs.io/user-guide/configuration/#content
|
||||
# content: |-
|
||||
# Any arbitrary text can be placed anywhere in the content
|
||||
#
|
||||
# {{ .Header }}
|
||||
#
|
||||
# and even in between sections
|
||||
#
|
||||
# {{ .Providers }}
|
||||
#
|
||||
# and they don't even need to be in the default order
|
||||
#
|
||||
# {{ .Outputs }}
|
||||
#
|
||||
# {{ .Inputs }}
|
||||
|
||||
# # see: https://terraform-docs.io/user-guide/configuration/#output
|
||||
# output:
|
||||
# file: README.md
|
||||
# mode: inject
|
||||
@@ -23,12 +41,13 @@ sections:
|
||||
# The template can be customized with aribitrary markdown content.
|
||||
# For example this can be shown before the actual content generated
|
||||
# by formatters.
|
||||
|
||||
#
|
||||
# {{ .Content }}
|
||||
|
||||
#
|
||||
# You can also show something after it!
|
||||
# <!-- END_TF_DOCS -->
|
||||
|
||||
# see: https://terraform-docs.io/user-guide/configuration/#sort
|
||||
sort:
|
||||
enabled: true
|
||||
by: required
|
||||
|
||||
Reference in New Issue
Block a user