core: Don't crash if EvaluateBlock returns nil during validation

There's actually no good reason for this to happen in the normal case, but
it can happen reasonably easy if a test doesn't properly configure the
MockEvalContext, and so having this check here makes test debugging a
little easier.
This commit is contained in:
Martin Atkins 2018-05-04 19:45:28 -07:00
parent 69d2fa0c15
commit 7dacb6b6a8
1 changed files with 5 additions and 0 deletions

View File

@ -142,6 +142,11 @@ func (n *EvalValidateProvisioner) Eval(ctx EvalContext) (interface{}, error) {
return nil, diags.Err()
}
if configVal == cty.NilVal {
// Should never happen for a well-behaved EvaluateBlock implementation
return nil, fmt.Errorf("EvaluateBlock returned nil value")
}
// The provisioner API still uses our legacy ResourceConfig type, so
// we need to shim it.
legacyRC := NewResourceConfigShimmed(configVal, schema)