fix: run provider configure anyway

main
sundowndev 2021-10-18 16:06:08 +02:00
parent 18850b3719
commit a6a5017724
1 changed files with 11 additions and 7 deletions

View File

@ -111,18 +111,22 @@ func (p *TerraformProvider) configure(alias string) error {
p.schemas = schema.ResourceTypes
}
// This value is optional. It'll be overridden by the provider config.
config := cty.NullVal(cty.DynamicPseudoType)
if p.Config.GetProviderConfig != nil {
configType := schema.Provider.Block.ImpliedType()
val, err := gocty.ToCtyValue(p.Config.GetProviderConfig(alias), configType)
config, err = gocty.ToCtyValue(p.Config.GetProviderConfig(alias), configType)
if err != nil {
return err
}
resp := p.grpcProviders[alias].Configure(providers.ConfigureRequest{
Config: val,
})
if resp.Diagnostics.HasErrors() {
return resp.Diagnostics.Err()
}
}
resp := p.grpcProviders[alias].Configure(providers.ConfigureRequest{
Config: config,
})
if resp.Diagnostics.HasErrors() {
return resp.Diagnostics.Err()
}
logrus.WithFields(logrus.Fields{