Reordering, comment update
This commit is contained in:
parent
06e72c693f
commit
e6817f6319
|
@ -283,7 +283,7 @@ func (s *SyncState) MaybeFixUpResourceInstanceAddressForCount(addr addrs.AbsReso
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetResourceInstanceCurrent saves the given instance object as the current
|
// SetResourceInstanceCurrent saves the given instance object as the current
|
||||||
// generation of the resource instance with the given address, simulataneously
|
// generation of the resource instance with the given address, simultaneously
|
||||||
// updating the recorded provider configuration address, dependencies, and
|
// updating the recorded provider configuration address, dependencies, and
|
||||||
// resource EachMode.
|
// resource EachMode.
|
||||||
//
|
//
|
||||||
|
|
|
@ -50,12 +50,12 @@ func (t *OrphanResourceCountTransformer) Transform(g *Graph) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *OrphanResourceCountTransformer) transformForEach(haveKeys map[addrs.InstanceKey]struct{}, 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,
|
// If there is a NoKey node, add this to the graph first,
|
||||||
// so that we can create edges to it in subsequent (StringKey) nodes.
|
// 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,
|
// 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,
|
// (see SetResourceInstanceCurrent for more information) and we need to evaluate
|
||||||
// that will change the resource's EachMode and our addressing for our instances
|
// an orphaned (NoKey) resource before the in-memory state is updated
|
||||||
// will not work as expected
|
// to deal with a new for_each resource
|
||||||
_, hasNoKeyNode := haveKeys[addrs.NoKey]
|
_, hasNoKeyNode := haveKeys[addrs.NoKey]
|
||||||
var noKeyNode dag.Vertex
|
var noKeyNode dag.Vertex
|
||||||
if hasNoKeyNode {
|
if hasNoKeyNode {
|
||||||
|
@ -68,14 +68,14 @@ func (t *OrphanResourceCountTransformer) transformForEach(haveKeys map[addrs.Ins
|
||||||
}
|
}
|
||||||
|
|
||||||
for key := range haveKeys {
|
for key := range haveKeys {
|
||||||
s, _ := key.(addrs.StringKey)
|
// If the key is no-key, we have already added it, so skip
|
||||||
// If the key is present in our current for_each, carry on
|
if key == addrs.NoKey {
|
||||||
if _, ok := t.ForEach[string(s)]; ok {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the key is no-key, we have already added it, so skip
|
s, _ := key.(addrs.StringKey)
|
||||||
if key == addrs.NoKey {
|
// If the key is present in our current for_each, carry on
|
||||||
|
if _, ok := t.ForEach[string(s)]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue