More comment updates, a lil refactor
This commit is contained in:
parent
ca9da51516
commit
fd34def9dc
|
@ -123,22 +123,21 @@ func (ms *Module) SetResourceInstanceCurrent(addr addrs.ResourceInstance, obj *R
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if rs == nil && obj != nil {
|
if rs == nil && obj != nil {
|
||||||
// We don't have have a resource
|
// We don't have have a resource so make one, which is a side effect of setResourceMeta
|
||||||
// make the resource! which happens in setResourceMeta, so okay
|
|
||||||
ms.SetResourceMeta(addr.Resource, eachModeForInstanceKey(addr.Key), provider)
|
ms.SetResourceMeta(addr.Resource, eachModeForInstanceKey(addr.Key), provider)
|
||||||
// now we have a resource! so update the rs value
|
// now we have a resource! so update the rs value to point to it
|
||||||
rs = ms.Resource(addr.Resource)
|
rs = ms.Resource(addr.Resource)
|
||||||
}
|
}
|
||||||
// Get our instance from the resource; it could be there or not at this point
|
// Get our instance from the resource; it could be there or not at this point
|
||||||
inst := rs.Instances[addr.Key]
|
is := rs.Instances[addr.Key]
|
||||||
if inst == nil {
|
if is == nil {
|
||||||
// if we don't have a resource, create one
|
// if we don't have a resource, create one and add to the instances
|
||||||
rs.Instances[addr.Key] = NewResourceInstance()
|
is = NewResourceInstance()
|
||||||
|
rs.Instances[addr.Key] = is
|
||||||
// update the resource meta because we have a new instance, so EachMode may have changed
|
// update the resource meta because we have a new instance, so EachMode may have changed
|
||||||
ms.SetResourceMeta(addr.Resource, eachModeForInstanceKey(addr.Key), provider)
|
ms.SetResourceMeta(addr.Resource, eachModeForInstanceKey(addr.Key), provider)
|
||||||
|
|
||||||
}
|
}
|
||||||
is := rs.EnsureInstance(addr.Key)
|
|
||||||
is.Current = obj
|
is.Current = obj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue