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).
This commit is contained in:
Chris Marchesi 2017-05-28 11:40:19 -07:00 committed by Martin Atkins
parent fa1fc2ca8e
commit f7e42728b6

View File

@ -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 {