rename methods for ConfigResource changes

This commit is contained in:
James Bardin 2020-05-13 08:59:34 -04:00
parent c6c851eb3f
commit 8e3728af54
3 changed files with 7 additions and 7 deletions

View File

@ -55,10 +55,10 @@ func (c *Changes) ResourceInstance(addr addrs.AbsResourceInstance) *ResourceInst
}
// ConfigResourceInstances returns the planned change for the current objects
// InstancesForConfigResource returns the planned change for the current objects
// of the resource instances of the given address, if any. Returns nil if no
// changes are planned.
func (c *Changes) ConfigResourceInstances(addr addrs.ConfigResource) []*ResourceInstanceChangeSrc {
func (c *Changes) InstancesForConfigResource(addr addrs.ConfigResource) []*ResourceInstanceChangeSrc {
var changes []*ResourceInstanceChangeSrc
for _, rc := range c.Resources {
resAddr := rc.Addr.ContainingResource().Config()

View File

@ -62,7 +62,7 @@ func (cs *ChangesSync) GetResourceInstanceChange(addr addrs.AbsResourceInstance,
panic(fmt.Sprintf("unsupported generation value %#v", gen))
}
// GetConfigResourceChanges searched the set of resource instance
// GetChangesForConfigResource 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.
@ -72,14 +72,14 @@ func (cs *ChangesSync) GetResourceInstanceChange(addr addrs.AbsResourceInstance,
// 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 {
func (cs *ChangesSync) GetChangesForConfigResource(addr addrs.ConfigResource) []*ResourceInstanceChangeSrc {
if cs == nil {
panic("GetConfigResourceChanges on nil ChangesSync")
panic("GetChangesForConfigResource on nil ChangesSync")
}
cs.lock.Lock()
defer cs.lock.Unlock()
var changes []*ResourceInstanceChangeSrc
for _, c := range cs.changes.ConfigResourceInstances(addr) {
for _, c := range cs.changes.InstancesForConfigResource(addr) {
changes = append(changes, c.DeepCopy())
}
return changes

View File

@ -158,7 +158,7 @@ func (n *EvalReadDataPlan) forcePlanRead(ctx EvalContext) bool {
// configuration.
changes := ctx.Changes()
for _, d := range n.dependsOn {
for _, change := range changes.GetConfigResourceChanges(d) {
for _, change := range changes.GetChangesForConfigResource(d) {
if change != nil && change.Action != plans.NoOp {
return true
}