From 7122b271f9226bd37c8b6292be6641f7e5aba8b2 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 20 May 2020 22:30:10 -0400 Subject: [PATCH] restore the ordering of nested modules In order for depends_on to work, modules need to implicitly depend on their child modules. This will have little effect on terraform's concurrency, as configuration trees are always much wider than they are deep. --- terraform/transform_module_expansion.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/terraform/transform_module_expansion.go b/terraform/transform_module_expansion.go index 41484cb6da..8d41465b74 100644 --- a/terraform/transform_module_expansion.go +++ b/terraform/transform_module_expansion.go @@ -60,6 +60,16 @@ func (t *ModuleExpansionTransformer) Transform(g *Graph) error { } } + // Modules implicitly depend on their child modules, so connect closers to + // other which contain their path. + for _, c := range t.closers { + for _, d := range t.closers { + if len(d.Addr) > len(c.Addr) && c.Addr.Equal(d.Addr[:len(c.Addr)]) { + g.Connect(dag.BasicEdge(c, d)) + } + } + } + return nil }