mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Add edge
This commit is contained in:
parent
3662dbc03d
commit
b9fa724273
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user