diff --git a/plans/changes.go b/plans/changes.go index 4140994889..72b6a8938b 100644 --- a/plans/changes.go +++ b/plans/changes.go @@ -39,7 +39,7 @@ func (c *Changes) Empty() bool { } for _, out := range c.Outputs { - if out.Action != NoOp { + if out.Addr.Module.IsRoot() && out.Action != NoOp { return false } } diff --git a/plans/plan_test.go b/plans/plan_test.go index 012ff06a68..b8a0e4501b 100644 --- a/plans/plan_test.go +++ b/plans/plan_test.go @@ -68,3 +68,28 @@ func TestProviderAddrs(t *testing.T) { t.Error(problem) } } + +// Module outputs should not effect the result of Empty +func TestModuleOutputChangesEmpty(t *testing.T) { + changes := &Changes{ + Outputs: []*OutputChangeSrc{ + { + Addr: addrs.AbsOutputValue{ + Module: addrs.RootModuleInstance.Child("child", addrs.NoKey), + OutputValue: addrs.OutputValue{ + Name: "output", + }, + }, + ChangeSrc: ChangeSrc{ + Action: Update, + Before: []byte("a"), + After: []byte("b"), + }, + }, + }, + } + + if !changes.Empty() { + t.Fatal("plan has no visible changes") + } +}