You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First I'd like to thank you all for such a great tool to help document the nightmare that is a complex multi-module Terraform script.
What problem are you facing?
There is no way to sort a custom content template excerpt (slice, e.g. ModuleCalls) by a key (e.g. Position.Line). Also depends_on is missing, but would not help, because I cannot sort by a property anyway. And the order is alphabetical, not in the order of appearance.
- [Modules](#modules){{- range .Module.ModuleCalls }}
- [{{ .Name }}](#{{ .Name }}){{- end }}
I cannot use sort or sortBy of any sorts, because it does not seem to be allowed.
If I could use sort, I probably might solve my problem: the modules appear in an alphabetical order rather than by the order of appearance in the main.tf (which would correspond to .Position.Line) or some depends_on order.
How could terraform-docs help solve your problem?
Solution idea 1
Would it perhaps be possible to include sort from Go templates standard library (or at least I think it is)?
I am not too well-versed in Go, but I think something like the following woud then become possible:
First I'd like to thank you all for such a great tool to help document the nightmare that is a complex multi-module Terraform script.
What problem are you facing?
There is no way to sort a custom
contenttemplate excerpt (slice, e.g.ModuleCalls) by a key (e.g.Position.Line). Alsodepends_onis missing, but would not help, because I cannot sort by a property anyway. And the order is alphabetical, not in the order of appearance.I have this
.terraform-docs.ymlconfiguration:.terraform-docs.ymlconfigurationThe relevant part is
I cannot use
sortorsortByof any sorts, because it does not seem to be allowed.If I could use
sort, I probably might solve my problem: the modules appear in an alphabetical order rather than by the order of appearance in themain.tf(which would correspond to.Position.Line) or somedepends_onorder.How could terraform-docs help solve your problem?
Solution idea 1
Would it perhaps be possible to include
sortfrom Go templates standard library (or at least I think it is)?I am not too well-versed in Go, but I think something like the following woud then become possible:
and then
Solution idea 2
Have the
ModuleCallsmap return the list in the order of appearance or in the order ofdepends_onproperties - if that's possible.Note
If you need any additional information, let me know.