Make terraform.Module available in content

Add one extra special variable the `content`:

- `{{ .Module }}`

As opposed to the other variables, which are generated sections based on
a selected formatter, the `{{ .Module }}` variable is just a `struct`
representing a Terraform module.

It can be used to build highly complex and highly customized content:

```yaml
content: |-
  ## Resources

  {{ range .Module.Resources }}
  - {{ .GetMode }}.{{ .Spec }} ({{ .Position.Filename }}#{{ .Position.Line }})
  {{- end }}
```

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
This commit is contained in:
Khosrow Moossavi
2021-10-04 15:17:41 -04:00
parent de684ce48c
commit 465dd14cff
34 changed files with 461 additions and 449 deletions

View File

@@ -32,6 +32,11 @@ sections:
#
# and even in between sections
#
# ## Resources
# {{ range .Module.Resources }}
# - {{ .GetMode }}.{{ .Spec }} ({{ .Position.Filename }}#{{ .Position.Line }})
# {{- end }}
#
# ## Examples
#
# ```hcl