From b738cdb19f29ee7b73747294978dcd6ffffaf029 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 14 Sep 2018 18:39:09 -0400 Subject: [PATCH] make Changes.Empty() not count NoOps This make the plan `Empty` concept more closely match the legacy diff behavior. Remove old unknown field from plan_test --- plans/changes.go | 7 ++++++- plans/plan_test.go | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plans/changes.go b/plans/changes.go index 69bfffaaa..1b85ba21c 100644 --- a/plans/changes.go +++ b/plans/changes.go @@ -32,7 +32,12 @@ func NewChanges() *Changes { } func (c *Changes) Empty() bool { - return (len(c.Resources) + len(c.Outputs)) == 0 + for _, res := range c.Resources { + if res.Action != NoOp { + return false + } + } + return true } // ResourceInstance returns the planned change for the current object of the diff --git a/plans/plan_test.go b/plans/plan_test.go index d6c2f769a..f68357072 100644 --- a/plans/plan_test.go +++ b/plans/plan_test.go @@ -13,7 +13,6 @@ func TestProviderAddrs(t *testing.T) { plan := &Plan{ VariableValues: map[string]DynamicValue{}, Changes: &Changes{ - RootOutputs: map[string]*OutputChangeSrc{}, Resources: []*ResourceInstanceChangeSrc{ { Addr: addrs.Resource{