hashicorp / hashicorp/terraform-plugin-docs
Support cross-file go templates
- Dominant language
- Go
- Stars
- 263
- Forks
- 84
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 2
Description
### Terraform CLI and terraform-plugin-docs Versions
Terraform: v1.11.3 on windows_amd64
tfplugindocs: latest (dev)
### Use Cases or Problem Statement
At the moment, it's only possible to reference and re-use different files via `codefile` and `tffile`. Both of them are markdown and it's not possible to include other template files or simply files without adding backticks for the markdown. The go templating function `template` can't be used because it doesn't get the references/defines of other files.
Adding this functionality would be very useful if several resources have common documentation parts like limitations or warnings.
### Proposal
Supporting the go templating function `template` so that it gets references and considers other template files.
e.g.,
```
templates/
├── partials/
│ ├── my-custom-template.tmpl
├── resources/
│ ├── my-resource.md.tmpl
```
`my-resource.md.tmpl`
```
# My Resource Documentation
This is the documentation for `my-resource`.
{{ template "my-custom-template" . }}
```
`my-custom-template.tmpl`
```
{{ define "my-custom-template" }}
## My Custom Template
This is reusable content for my custom template.
{{ end }}
```
### How much impact is this issue causing?
Low
### Additional Information
_No response_
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.