Skip to content

Commit

Permalink
add whole resource references
Browse files Browse the repository at this point in the history
  • Loading branch information
jbardin committed Feb 7, 2022
1 parent 863dd18 commit d87d6b3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/command/views/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ func renderChangesDetectedByRefresh(plan *plans.Plan, schemas *terraform.Schemas
// only showing the attributes we're interested in.
// The resulting change will be a NoOp if it has nothing relevant to the plan.
func filterRefreshChange(change *plans.ResourceInstanceChange, contributing []globalref.ResourceAttr) plans.Change {

if change.Action == plans.NoOp {
return change.Change
}
Expand All @@ -462,7 +463,13 @@ func filterRefreshChange(change *plans.ResourceInstanceChange, contributing []gl
resAddr := change.Addr

for _, attr := range contributing {
if resAddr.Equal(attr.Resource) {
if !resAddr.ContainingResource().Equal(attr.Resource.ContainingResource()) {
continue
}

// If the contributing address has no instance key, then the
// contributing reference applies to all instances.
if attr.Resource.Resource.Key == addrs.NoKey || resAddr.Equal(attr.Resource) {
relevantAttrs = append(relevantAttrs, attr.Attr)
}
}
Expand Down

0 comments on commit d87d6b3

Please sign in to comment.