don't connect destroyers to module expanders

Resource destroy nodes can only depend on other resources. Connecting
them to their module expander can introduce cycles when the module
expander depends on resources in the destroyer's subgraph.
This commit is contained in:
James Bardin 2020-05-27 22:09:21 -04:00
parent a9e0f46f23
commit d97a210ad3
1 changed files with 5 additions and 0 deletions

View File

@ -47,6 +47,7 @@ func (t *ModuleExpansionTransformer) Transform(g *Graph) error {
if _, ok := v.(*nodeCloseModule); ok {
continue
}
// any node that executes within the scope of a module should be a
// GraphNodeModulePath
pather, ok := v.(GraphNodeModulePath)
@ -113,6 +114,10 @@ func (t *ModuleExpansionTransformer) transform(g *Graph, c *configs.Config, pare
var path addrs.Module
switch t := childV.(type) {
case GraphNodeDestroyer:
// skip destroyers, as they can only depend on other resources.
continue
case GraphNodeModulePath:
path = t.ModulePath()
case GraphNodeReferenceOutside: