-
Notifications
You must be signed in to change notification settings - Fork 568
Description
What problem are you facing?
For readability, I'd like to be able to have some control or include markdown in my resource comments. My Terraform use case is a bit different than most, as I'm (ab)using "local_file" to leverage Terraform's template system (it's a module that feeds into configuration elsewhere, so there's a point to this use).
Currently, the only way to get a .Description
on a resource
is to add a //
or #
comment block right before the resource
call. The current implementation squashes any and all newlines.
So
// this simple text
//
// should be understandable
resource "" "" { }
gets rendered to
this simple text should be understandable
and does not appear to be anything I can do beyond writing my own plugin (I'm not very conversant in Go).
How could terraform-docs help solve your problem?
I'd like to be able to paragraph out text instead of it turning into a single blob, either through some flag setting or a secondary builtin function (so tostring
could squash everything into one line, while tomultilinestring
(just spitballing for names) would either preserve the line breaks or produce something I can use range
over.
The closest workaround I have is to (ab)use the extra space in the join
call
{{ with .Description.Raw | split " " -}} {{ range .}}
- {{. | sanitizeDoc}} {{ end }} {{ end }}
and treat it as a marker.