From e22f1d5dceedf40c3e196f820646c51923ea0be2 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Wed, 30 May 2018 16:25:39 -0700 Subject: [PATCH] core: Don't try to run provisioners with nil state If a resource has been removed altogether then we have nothing to provision. --- terraform/eval_apply.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terraform/eval_apply.go b/terraform/eval_apply.go index c445e25ab..6bd1e611b 100644 --- a/terraform/eval_apply.go +++ b/terraform/eval_apply.go @@ -205,6 +205,10 @@ type EvalApplyProvisioners struct { // TODO: test func (n *EvalApplyProvisioners) Eval(ctx EvalContext) (interface{}, error) { state := *n.State + if state == nil { + log.Printf("[TRACE] EvalApplyProvisioners: %s has no state, so skipping provisioners", n.Addr) + return nil, nil + } // The hook API still uses the legacy InstanceInfo type, so we need to shim it. legacyInfo := NewInstanceInfo(n.Addr.Absolute(ctx.Path()))