From 2b8e876bdb62bfae0d6b93df0b04b265bbb815ba Mon Sep 17 00:00:00 2001 From: Pam Selle <204372+pselle@users.noreply.github.com> Date: Thu, 5 Dec 2019 16:00:19 -0500 Subject: [PATCH] Don't inspect an empty set, return false --- command/format/diff.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/command/format/diff.go b/command/format/diff.go index 8b1a7edf1..2f2258de0 100644 --- a/command/format/diff.go +++ b/command/format/diff.go @@ -1014,8 +1014,9 @@ func (p *blockBodyDiffPrinter) writeActionSymbol(action plans.Action) { } func (p *blockBodyDiffPrinter) pathForcesNewResource(path cty.Path) bool { - if !p.action.IsReplace() { - // "requiredReplace" only applies when the instance is being replaced + if !p.action.IsReplace() || p.requiredReplace.Empty() { + // "requiredReplace" only applies when the instance is being replaced, + // and we should only inspect that set if it is not empty return false } return p.requiredReplace.Has(path)