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.
This commit is contained in:
James Bardin 2020-05-20 22:30:10 -04:00
parent 63b54f2b72
commit 7122b271f9
1 changed files with 10 additions and 0 deletions

View File

@ -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 return nil
} }