From f0cd8be66f33a30082d000bef6963eb8db33f931 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Mon, 7 Feb 2022 14:31:45 -0500 Subject: [PATCH] add whole resource references --- internal/command/views/plan.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/command/views/plan.go b/internal/command/views/plan.go index c3c1283cf..37bd7dfa6 100644 --- a/internal/command/views/plan.go +++ b/internal/command/views/plan.go @@ -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 } @@ -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) } }