mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
core: Better error message for faulty provider in EvalRefresh
This commit is contained in:
parent
297f1019d5
commit
a8d62478c6
@ -4,6 +4,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
|
"github.com/zclconf/go-cty/cty"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/addrs"
|
"github.com/hashicorp/terraform/addrs"
|
||||||
"github.com/hashicorp/terraform/providers"
|
"github.com/hashicorp/terraform/providers"
|
||||||
"github.com/hashicorp/terraform/states"
|
"github.com/hashicorp/terraform/states"
|
||||||
@ -62,6 +64,13 @@ func (n *EvalRefresh) Eval(ctx EvalContext) (interface{}, error) {
|
|||||||
return nil, diags.Err()
|
return nil, diags.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if resp.NewState == cty.NilVal {
|
||||||
|
// This ought not to happen in real cases since it's not possible to
|
||||||
|
// send NilVal over the plugin RPC channel, but it can come up in
|
||||||
|
// tests due to sloppy mocking.
|
||||||
|
panic("new state is cty.NilVal")
|
||||||
|
}
|
||||||
|
|
||||||
for _, err := range schema.ImpliedType().TestConformance(resp.NewState.Type()) {
|
for _, err := range schema.ImpliedType().TestConformance(resp.NewState.Type()) {
|
||||||
diags = diags.Append(tfdiags.Sourceless(
|
diags = diags.Append(tfdiags.Sourceless(
|
||||||
tfdiags.Error,
|
tfdiags.Error,
|
||||||
|
Loading…
Reference in New Issue
Block a user