mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
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:
parent
69d2fa0c15
commit
7dacb6b6a8
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user