From f7e42728b640dd0a14b919c0ef2b2f2a52e26835 Mon Sep 17 00:00:00 2001 From: Chris Marchesi Date: Sun, 28 May 2017 11:40:19 -0700 Subject: [PATCH] helper/schema: Remove unused Destroy check for CustomizeDiff Both Destroy and DestroyDeposed are not propagated down the diff stack, meaning that there is no way we can tell at this point if an instance is being destroyed or deposed, so this check would never be used. In this regard, Destroy never runs a diff down the stack at all, and a deposition check is not run until *after* the provider's diff function is called. To answer this question and close it off, we could either determine if a resource is deposed earlier, and propagate that down, or treat deposed resources like full destroy nodes, and not diff them at all (but rather making a diff with the only thing in it being DestroyDeposed flagged). --- helper/schema/schema.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helper/schema/schema.go b/helper/schema/schema.go index ff315e7df..b0b9c937b 100644 --- a/helper/schema/schema.go +++ b/helper/schema/schema.go @@ -411,7 +411,7 @@ func (m schemaMap) Diff( // If this is a non-destroy diff, call any custom diff logic that has been // defined. - if !result.Destroy && !result.DestroyTainted && customizeFunc != nil { + if !result.DestroyTainted && customizeFunc != nil { mc := m.DeepCopy() rd := newResourceDiff(mc, c, s, result) if err := customizeFunc(rd, meta); err != nil { @@ -451,7 +451,7 @@ func (m schemaMap) Diff( } // Re-run customization - if !result2.Destroy && !result2.DestroyTainted && customizeFunc != nil { + if !result2.DestroyTainted && customizeFunc != nil { mc := m.DeepCopy() rd := newResourceDiff(mc, c, d.state, result2) if err := customizeFunc(rd, meta); err != nil {