This commit is contained in:
Pam Selle 2019-08-13 10:24:26 -04:00
parent 3662dbc03d
commit b9fa724273
1 changed files with 7 additions and 1 deletions

View File

@ -51,7 +51,8 @@ func (t *OrphanResourceCountTransformer) Transform(g *Graph) error {
func (t *OrphanResourceCountTransformer) transformForEach(haveKeys map[addrs.InstanceKey]struct{}, g *Graph) error {
// If there is a no-key node, add this to the graph first,
// because the last item determines the resource mode for the whole resource,
// so that we can create edges to it in subsequent (StringKey) nodes.
// This is because the last item determines the resource mode for the whole resource,
// so if this (non-deterministically) happens to end up as the last one,
// that will change the resource's EachMode and our addressing for our instances
// will not work as expected
@ -79,6 +80,11 @@ func (t *OrphanResourceCountTransformer) transformForEach(haveKeys map[addrs.Ins
}
log.Printf("[TRACE] OrphanResourceCount(non-zero): adding %s as %T", t.Addr, node)
g.Add(node)
// Add edge to noKeyNode if it exists
if hasNoKeyNode {
g.Connect(dag.BasicEdge(node, noKeyNode))
}
}
return nil
}