core: Don't try to run provisioners with nil state

If a resource has been removed altogether then we have nothing to
provision.
This commit is contained in:
Martin Atkins 2018-05-30 16:25:39 -07:00
parent 3e64311dc2
commit e22f1d5dce
1 changed files with 4 additions and 0 deletions

View File

@ -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()))