mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
index provider schemas by type
A provider's schema is the same regardless of its address in the config. Key them by type so that an evaluation referencing a provider from an address not included in the graph can still find the schema.
This commit is contained in:
parent
c8dfc944fe
commit
fd4b427162
@ -141,7 +141,7 @@ func (ctx *BuiltinEvalContext) InitProvider(typeName string, addr addrs.Provider
|
||||
if ctx.ProviderSchemas == nil {
|
||||
ctx.ProviderSchemas = make(map[string]*ProviderSchema)
|
||||
}
|
||||
ctx.ProviderSchemas[key] = schema
|
||||
ctx.ProviderSchemas[typeName] = schema
|
||||
|
||||
return p, nil
|
||||
}
|
||||
@ -161,7 +161,7 @@ func (ctx *BuiltinEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) *Pro
|
||||
ctx.ProviderLock.Lock()
|
||||
defer ctx.ProviderLock.Unlock()
|
||||
|
||||
return ctx.ProviderSchemas[addr.String()]
|
||||
return ctx.ProviderSchemas[addr.ProviderConfig.Type]
|
||||
}
|
||||
|
||||
func (ctx *BuiltinEvalContext) CloseProvider(addr addrs.ProviderConfig) error {
|
||||
|
@ -690,7 +690,7 @@ func (d *evaluationStateData) getResourceSchema(addr addrs.Resource, providerAdd
|
||||
defer d.Evaluator.ProvidersLock.Unlock()
|
||||
|
||||
log.Printf("[TRACE] Need provider schema for %s", providerAddr)
|
||||
providerSchema := d.Evaluator.ProviderSchemas[providerAddr.String()]
|
||||
providerSchema := d.Evaluator.ProviderSchemas[providerAddr.ProviderConfig.Type]
|
||||
if providerSchema == nil {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user