mirror of
https://github.com/opentofu/opentofu.git
synced 2026-06-08 16:12:24 -04:00
Handle provider resource not found in compile_resource.go
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
parent
13daa88a0a
commit
2b2a697c90
1 changed files with 12 additions and 1 deletions
|
|
@ -7,7 +7,9 @@ package tofu2024
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/hcl/v2"
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
|
||||
"github.com/opentofu/opentofu/internal/addrs"
|
||||
|
|
@ -65,7 +67,16 @@ func compileModuleInstanceResource(
|
|||
resourceAddr.Type,
|
||||
)
|
||||
if diags.HasErrors() {
|
||||
configEvalable = exprs.ForcedErrorEvalable(diags, tfdiags.SourceRangeFromHCL(config.DeclRange))
|
||||
configEvalable = exprs.ForcedErrorEvalable(diags, tfdiags.SourceRangeFromHCL(config.TypeRange))
|
||||
} else if resourceTypeSchema == nil {
|
||||
suggestion := "TODO suggestion" //TODO NodeValidatableResource.noResourceSchemaSuggestion
|
||||
diags = diags.Append(&hcl.Diagnostic{
|
||||
Severity: hcl.DiagError,
|
||||
Summary: "Invalid resource type",
|
||||
Detail: fmt.Sprintf("The provider %s does not support resource type %q.%s", config.Provider.ForDisplay(), resourceAddr.Type, suggestion),
|
||||
Subject: config.TypeRange.Ptr(),
|
||||
})
|
||||
configEvalable = exprs.ForcedErrorEvalable(diags, tfdiags.SourceRangeFromHCL(config.TypeRange))
|
||||
} else {
|
||||
spec := resourceTypeSchema.Block.DecoderSpec()
|
||||
configEvalable = exprs.EvalableHCLBodyWithDynamicBlocks(config.Config, spec)
|
||||
|
|
|
|||
Loading…
Reference in a new issue