From c03a4b93f83164df12710c4ef23f4f40b3ce2b18 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Fri, 29 Mar 2024 08:20:46 -0400 Subject: [PATCH] Remove some unused provider schema abstractions (#1444) Signed-off-by: Christian Mesh --- internal/tofu/eval_context_builtin.go | 15 --------------- internal/tofu/graph_walk_context.go | 5 ----- 2 files changed, 20 deletions(-) diff --git a/internal/tofu/eval_context_builtin.go b/internal/tofu/eval_context_builtin.go index 5c333bc21e..d4e4419351 100644 --- a/internal/tofu/eval_context_builtin.go +++ b/internal/tofu/eval_context_builtin.go @@ -155,21 +155,6 @@ func (ctx *BuiltinEvalContext) Provider(addr addrs.AbsProviderConfig) providers. } func (ctx *BuiltinEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) (providers.ProviderSchema, error) { - // first see if we have already have an initialized provider to avoid - // re-loading it only for the schema - p := ctx.Provider(addr) - if p != nil { - resp := p.GetProviderSchema() - // convert any diagnostics here in case this is the first call - // FIXME: better control provider instantiation so we can be sure this - // won't be the first call to ProviderSchema - var err error - if resp.Diagnostics.HasErrors() { - err = resp.Diagnostics.ErrWithWarnings() - } - return resp, err - } - return ctx.Plugins.ProviderSchema(addr.Provider) } diff --git a/internal/tofu/graph_walk_context.go b/internal/tofu/graph_walk_context.go index 80d4e795ba..ef2bc3fbbd 100644 --- a/internal/tofu/graph_walk_context.go +++ b/internal/tofu/graph_walk_context.go @@ -15,7 +15,6 @@ import ( "github.com/opentofu/opentofu/internal/addrs" "github.com/opentofu/opentofu/internal/checks" "github.com/opentofu/opentofu/internal/configs" - "github.com/opentofu/opentofu/internal/configs/configschema" "github.com/opentofu/opentofu/internal/encryption" "github.com/opentofu/opentofu/internal/instances" "github.com/opentofu/opentofu/internal/plans" @@ -58,10 +57,8 @@ type ContextGraphWalker struct { variableValues map[string]map[string]cty.Value variableValuesLock sync.Mutex providerCache map[string]providers.Interface - providerSchemas map[string]providers.ProviderSchema providerLock sync.Mutex provisionerCache map[string]provisioners.Interface - provisionerSchemas map[string]*configschema.Block provisionerLock sync.Mutex } @@ -128,9 +125,7 @@ func (w *ContextGraphWalker) EvalContext() EvalContext { func (w *ContextGraphWalker) init() { w.contexts = make(map[string]*BuiltinEvalContext) w.providerCache = make(map[string]providers.Interface) - w.providerSchemas = make(map[string]providers.ProviderSchema) w.provisionerCache = make(map[string]provisioners.Interface) - w.provisionerSchemas = make(map[string]*configschema.Block) w.variableValues = make(map[string]map[string]cty.Value) // Populate root module variable values. Other modules will be populated