ModuleCalls
sorted / ordered alphabetically rather than in the order of appearance or by "depends_on" property
#840
Labels
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
). Alsodepends_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.I have this
.terraform-docs.yml
configuration:.terraform-docs.yml
configurationThe relevant part is
I cannot use
sort
orsortBy
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 themain.tf
(which would correspond to.Position.Line
) or somedepends_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:
and then
Solution idea 2
Have the
ModuleCalls
map return the list in the order of appearance or in the order ofdepends_on
properties - if that's possible.Note
If you need any additional information, let me know.
The text was updated successfully, but these errors were encountered: