content

Since v0.14.0

Generated content can be customized further away with content in configuration. If the content is empty the default order of sections is used.

content is a Go template with following additional variables:

  • {{ .Header }}
  • {{ .Footer }}
  • {{ .Inputs }}
  • {{ .Modules }}
  • {{ .Outputs }}
  • {{ .Providers }}
  • {{ .Requirements }}
  • {{ .Resources }}

and following functions:

  • {{ include "relative/path/to/file" }}

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 so on.

Options

Available options with their default values.

content: ""

Examples

Content can be customized, rearranged. It can have arbitrary text in between sections:

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 }}  

Relative files can be included in the content:

content: |-
  include any relative files

  {{ include "relative/path/to/file" }}  

include can be used to add example snippet code in the content:

content: |-
  # Examples

  ```hcl
  {{ include "examples/foo/main.tf" }}
  ```  

In the following example, although {{ .Providers }} is defined it won’t be rendered because providers is not set to be shown in sections.show.

sections:
  show:
    - header
    - inputs
    - outputs

content: |-
  {{ .Header }}

  Some more information can go here.

  {{ .Providers }}

  {{ .Inputs }}

  {{ .Outputs }}  

Edit on GitHub