func resourceProviderFactories(resolver providers.Resolver, reqd discovery.PluginRequirements) (map[string]providers.Factory, tfdiags.Diagnostics) {
	var diags tfdiags.Diagnostics
	ret, errs := resolver.ResolveProviders(reqd)
	if errs != nil {
		diags = diags.Append(
			tfdiags.Sourceless(tfdiags.Error,
				"Could not satisfy plugin requirements",
				errPluginInit,
			),
		)
		for _, err := range errs {
			diags = diags.Append(err)
		}
		return nil, diags
	}
	return ret, nil
}
resourceProviderFactories matches available plugins to the given version
requirements to produce a map of compatible provider plugins if possible,
or an error if the currently-available plugins are insufficient.

This should be called only with configurations that have passed calls
to config.Validate(), which ensures that all of the given version
constraints are valid. It will panic if any invalid constraints are present.
package terraform
import (
	"fmt"
	"github.com/hashicorp/terraform/tfdiags"
	"github.com/hashicorp/terraform/plugin/discovery"
	"github.com/hashicorp/terraform/providers"
)
type ResourceProvider interface {
	GetSchema(*ProviderSchemaRequest) (*ProviderSchema, error)
	Input(UIInput, *ResourceConfig) (*ResourceConfig, error)
	Validate(*ResourceConfig) ([]string, []error)
	Configure(*ResourceConfig) error
	Resources() []ResourceType
	Stop() error
	ValidateResource(string, *ResourceConfig) ([]string, []error)
	Apply(
		*InstanceInfo,
		*InstanceState,
		*InstanceDiff) (*InstanceState, error)
	Diff(
		*InstanceInfo,
		*InstanceState,
		*ResourceConfig) (*InstanceDiff, error)
	Refresh(*InstanceInfo, *InstanceState) (*InstanceState, error)
	ImportState(*InstanceInfo, string) ([]*InstanceState, error)
	ValidateDataSource(string, *ResourceConfig) ([]string, []error)
	DataSources() []DataSource
	ReadDataDiff(*InstanceInfo, *ResourceConfig) (*InstanceDiff, error)
	ReadDataApply(*InstanceInfo, *InstanceDiff) (*InstanceState, error)
}
type ResourceProviderCloser interface {
	Close() error
}
type ResourceType struct {
	Name       string  
	Importable bool    
	SchemaAvailable bool
}
type DataSource struct {
	Name string
	SchemaAvailable bool
}
type ResourceProviderResolver interface {
	ResolveProviders(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error)
}
type ResourceProviderResolverFunc func(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error)
func (f ResourceProviderResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) {
	return f(reqd)
}
func ResourceProviderResolverFixed(factories map[string]ResourceProviderFactory) ResourceProviderResolver {
	return ResourceProviderResolverFunc(func(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) {
		ret := make(map[string]ResourceProviderFactory, len(reqd))
		var errs []error
		for name := range reqd {
			if factory, exists := factories[name]; exists {
				ret[name] = factory
			} else {
				errs = append(errs, fmt.Errorf("provider %q is not available", name))
			}
		}
		return ret, errs
	})
}
type ResourceProviderFactory func() (ResourceProvider, error)
func ResourceProviderFactoryFixed(p ResourceProvider) ResourceProviderFactory {
	return func() (ResourceProvider, error) {
		return p, nil
	}
}
func ProviderHasResource(p ResourceProvider, n string) bool {
	for _, rt := range p.Resources() {
		if rt.Name == n {
			return true
		}
	}
	return false
}
func ProviderHasDataSource(p ResourceProvider, n string) bool {
	for _, rt := range p.DataSources() {
		if rt.Name == n {
			return true
		}
	}
	return false
}