core: EvalConfigProvider shouldn't crash if its provider isn't set
While there's no good reason for this to happen in practice, it can arise in tests if mocks aren't set up quite right, and so we'll catch it and report it nicely to make test debugging a little easier.
This commit is contained in:
parent
7dacb6b6a8
commit
26c1584317
|
@ -36,6 +36,13 @@ type EvalConfigProvider struct {
|
|||
}
|
||||
|
||||
func (n *EvalConfigProvider) Eval(ctx EvalContext) (interface{}, error) {
|
||||
if n.Provider == nil {
|
||||
return nil, fmt.Errorf("EvalConfigProvider Provider is nil")
|
||||
}
|
||||
if n.Config == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var diags tfdiags.Diagnostics
|
||||
provider := *n.Provider
|
||||
config := n.Config
|
||||
|
|
Loading…
Reference in New Issue