func legacyPluginMap(opts *ServeOpts) map[string]plugin.Plugin {
	return map[string]plugin.Plugin{
		"provider": &ResourceProviderPlugin{
			ResourceProvider: opts.ProviderFunc,
		},
	}
}
pluginMap returns the legacy map[string]plugin.Plugin to use for configuring
a plugin server or client.
package plugin
import (
	"github.com/hashicorp/go-plugin"
	grpcplugin "github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin"
	proto "github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5"
	"github.com/hashicorp/terraform-plugin-sdk/terraform"
)
const (
	ProviderPluginName = "provider"
	DefaultProtocolVersion = 4
)
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion: DefaultProtocolVersion,
	MagicCookieKey:   "TF_PLUGIN_MAGIC_COOKIE",
	MagicCookieValue: "d602bf8f470bc67ca7faa0386276bbdd4330efaf76d1a219cb4d6991ca9872b2",
}
type ProviderFunc func() terraform.ResourceProvider
type GRPCProviderFunc func() proto.ProviderServer
type ServeOpts struct {
	ProviderFunc ProviderFunc
	GRPCProviderFunc GRPCProviderFunc
}
func Serve(opts *ServeOpts) {
	if opts.GRPCProviderFunc == nil && opts.ProviderFunc != nil {
		provider := grpcplugin.NewGRPCProviderServerShim(opts.ProviderFunc())
		if provider != nil {
			opts.GRPCProviderFunc = func() proto.ProviderServer {
				return provider
			}
		}
	}
	plugin.Serve(&plugin.ServeConfig{
		HandshakeConfig:  Handshake,
		VersionedPlugins: pluginSet(opts),
		GRPCServer:       plugin.DefaultGRPCServer,
	})
}