mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
core: Tolerate missing provider config schema in EvalValidateProvider
This should never happen in real code, but it comes up a lot in test code where incomplete mock schemas are being used to test with very simple configurations.
This commit is contained in:
parent
e4e3876332
commit
b8c3b8d45d
@ -2,6 +2,7 @@ package terraform
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hashicorp/hcl2/hcl"
|
||||
"github.com/hashicorp/terraform/addrs"
|
||||
@ -92,6 +93,13 @@ func (n *EvalValidateProvider) Eval(ctx EvalContext) (interface{}, error) {
|
||||
}
|
||||
|
||||
configSchema := schema.Provider
|
||||
if configSchema == nil {
|
||||
// Should never happen in real code, but often comes up in tests where
|
||||
// mock schemas are being used that tend to be incomplete.
|
||||
log.Printf("[WARN] EvalValidateProvider: no config schema is available for %s, so using empty schema", n.Addr)
|
||||
configSchema = &configschema.Block{}
|
||||
}
|
||||
|
||||
configBody := buildProviderConfig(ctx, n.Addr, sourceBody)
|
||||
configVal, configBody, evalDiags := ctx.EvaluateBlock(configBody, configSchema, nil, addrs.NoKey)
|
||||
diags = diags.Append(evalDiags)
|
||||
|
Loading…
Reference in New Issue
Block a user