plugin

package
v2.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2022 License: MPL-2.0 Imports: 12 Imported by: 1,327

Documentation

Index

Constants

View Source
const (
	// The constants below are the names of the plugins that can be dispensed
	// from the plugin server.
	//
	// Deprecated: This is no longer used, but left for backwards compatibility
	// since it is exported. It will be removed in the next major version.
	ProviderPluginName = "provider"
)

Variables

View Source
var Handshake = plugin.HandshakeConfig{

	MagicCookieKey:   "TF_PLUGIN_MAGIC_COOKIE",
	MagicCookieValue: "d602bf8f470bc67ca7faa0386276bbdd4330efaf76d1a219cb4d6991ca9872b2",
}

Handshake is the HandshakeConfig used to configure clients and servers.

Deprecated: This is no longer used, but left for backwards compatibility since it is exported. It will be removed in the next major version.

Functions

func Debug deprecated

func Debug(ctx context.Context, providerAddr string, opts *ServeOpts) error

Debug starts a debug server and controls its lifecycle, printing the information needed for Terraform to connect to the provider to stdout. os.Interrupt will be captured and used to stop the server.

Deprecated: Use the Serve function with the ServeOpts Debug field instead.

func Serve

func Serve(opts *ServeOpts)

Serve serves a plugin. This function never returns and should be the final function called in the main function of the plugin.

Types

type GRPCProviderFunc

type GRPCProviderFunc func() tfprotov5.ProviderServer

type GRPCProviderV6Func added in v2.7.0

type GRPCProviderV6Func func() tfprotov6.ProviderServer

type ProviderFunc

type ProviderFunc func() *schema.Provider

type ReattachConfig

type ReattachConfig struct {
	Protocol        string
	ProtocolVersion int
	Pid             int
	Test            bool
	Addr            ReattachConfigAddr
}

ReattachConfig holds the information Terraform needs to be able to attach itself to a provider process, so it can drive the process.

func DebugServe

func DebugServe(ctx context.Context, opts *ServeOpts) (ReattachConfig, <-chan struct{}, error)

DebugServe starts a plugin server in debug mode; this should only be used when the provider will manage its own lifecycle. It is not recommended for normal usage; Serve is the correct function for that.

type ReattachConfigAddr

type ReattachConfigAddr struct {
	Network string
	String  string
}

ReattachConfigAddr is a JSON-encoding friendly version of net.Addr.

type ServeOpts

type ServeOpts struct {
	ProviderFunc ProviderFunc

	// Wrapped versions of the above plugins will automatically shimmed and
	// added to the GRPC functions when possible.
	GRPCProviderFunc GRPCProviderFunc

	GRPCProviderV6Func GRPCProviderV6Func

	// Logger is the logger that go-plugin will use.
	Logger hclog.Logger

	// Debug starts a debug server and controls its lifecycle, printing the
	// information needed for Terraform to connect to the provider to stdout.
	// os.Interrupt will be captured and used to stop the server.
	//
	// This option cannot be combined with TestConfig.
	Debug bool

	// TestConfig should only be set when the provider is being tested; it
	// will opt out of go-plugin's lifecycle management and other features,
	// and will use the supplied configuration options to control the
	// plugin's lifecycle and communicate connection information. See the
	// go-plugin GoDoc for more information.
	//
	// This option cannot be combined with Debug.
	TestConfig *plugin.ServeTestConfig

	// Set NoLogOutputOverride to not override the log output with an hclog
	// adapter. This should only be used when running the plugin in
	// acceptance tests.
	NoLogOutputOverride bool

	// UseTFLogSink is the testing.T for a test function that will turn on
	// the terraform-plugin-log logging sink.
	UseTFLogSink testing.T

	// ProviderAddr is the address of the provider under test, like
	// registry.terraform.io/hashicorp/random.
	ProviderAddr string
}

ServeOpts are the configurations to serve a plugin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL