func ProviderHasDataSource(provider Interface, dataSourceName string) bool {
	resp := provider.GetSchema()
	if resp.Diagnostics.HasErrors() {
		return false
	}
	_, exists := resp.DataSources[dataSourceName]
	return exists
}
ProviderHasDataSource is a helper that requests schema from the given
provider and checks if it has a data source of the given name.

This function is more expensive than it may first appear since it must
retrieve the entire schema from the underlying provider, and so it should
be used sparingly and especially not in tight loops.

Since retrieving the provider may fail (e.g. if the provider is accessed
over an RPC channel that has operational problems), this function will
return false if the schema cannot be retrieved, under the assumption that
a subsequent call to do anything with the data source would fail
anyway.
package providers
import (
	"fmt"
	"github.com/hashicorp/terraform/addrs"
	"github.com/hashicorp/terraform/plugin/discovery"
)
type Resolver interface {
	ResolveProviders(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error)
}
type ResolverFunc func(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error)
func (f ResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) {
	return f(reqd)
}
func ResolverFixed(factories map[addrs.Provider]Factory) Resolver {
	return ResolverFunc(func(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) {
		ret := make(map[addrs.Provider]Factory, len(reqd))
		var errs []error
		for name := range reqd {
			fqn := addrs.NewLegacyProvider(name)
			if factory, exists := factories[fqn]; exists {
				ret[fqn] = factory
			} else {
				errs = append(errs, fmt.Errorf("provider %q is not available", name))
			}
		}
		return ret, errs
	})
}
type Factory func() (Interface, error)
func FactoryFixed(p Interface) Factory {
	return func() (Interface, error) {
		return p, nil
	}
}
func ProviderHasResource(provider Interface, typeName string) bool {
	resp := provider.GetSchema()
	if resp.Diagnostics.HasErrors() {
		return false
	}
	_, exists := resp.ResourceTypes[typeName]
	return exists
}