|
|
|
|
@ -62,6 +62,29 @@ func (cs *ChangesSync) GetResourceInstanceChange(addr addrs.AbsResourceInstance,
|
|
|
|
|
panic(fmt.Sprintf("unsupported generation value %#v", gen))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetConfigResourceChanges searched the set of resource instance
|
|
|
|
|
// changes and returns all changes related to a given configuration address.
|
|
|
|
|
// This is be used to find possible changes related to a configuration
|
|
|
|
|
// reference.
|
|
|
|
|
//
|
|
|
|
|
// If no such changes exist, nil is returned.
|
|
|
|
|
//
|
|
|
|
|
// The returned objects are a deep copy of the change recorded in the plan, so
|
|
|
|
|
// callers may mutate them although it's generally better (less confusing) to
|
|
|
|
|
// treat planned changes as immutable after they've been initially constructed.
|
|
|
|
|
func (cs *ChangesSync) GetConfigResourceChanges(addr addrs.ConfigResource) []*ResourceInstanceChangeSrc {
|
|
|
|
|
if cs == nil {
|
|
|
|
|
panic("GetConfigResourceChanges on nil ChangesSync")
|
|
|
|
|
}
|
|
|
|
|
cs.lock.Lock()
|
|
|
|
|
defer cs.lock.Unlock()
|
|
|
|
|
var changes []*ResourceInstanceChangeSrc
|
|
|
|
|
for _, c := range cs.changes.ConfigResourceInstances(addr) {
|
|
|
|
|
changes = append(changes, c.DeepCopy())
|
|
|
|
|
}
|
|
|
|
|
return changes
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// RemoveResourceInstanceChange searches the set of resource instance changes
|
|
|
|
|
// for one matching the given address and generation, and removes it from the
|
|
|
|
|
// set if it exists.
|
|
|
|
|
|