plugins

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const TraceNameStartProvider = "Start provider"

TraceNameStartProvider is the span name for starting a provider plugin (GitHub issue #1898): launching its process, the go-plugin handshake and dispensing the client.

Variables

This section is empty.

Functions

This section is empty.

Types

type Library

type Library interface {
	NewProviderManager() ProviderManager
	NewProvisionerManager() ProvisionerManager

	HasProvider(addr addrs.Provider) bool
	HasProvisioner(typ string) bool
}

Library represents a suite of provider and provisioner plugins. It does not expose much functionality itself, instead serving as a starting point for the more complex managers.

func NewLibrary

func NewLibrary(providerFactories ProviderFactories, provisionerFactories ProvisionerFactories) Library

func NewLibraryWithLaunchers added in v0.22.0

func NewLibraryWithLaunchers(providerFactories ProviderFactories, providerLaunchers ProviderLaunchers, provisionerFactories ProvisionerFactories) Library

NewLibraryWithLaunchers is NewLibrary with launchers for the providers that have one. A provider started through a launcher gets the "Start provider" span as its trace parent (GitHub issue #1898); a provider with only a factory still gets the span, but its process is not handed it.

type ProviderFactories

type ProviderFactories map[addrs.Provider]providers.Factory

func (ProviderFactories) HasProvider

func (p ProviderFactories) HasProvider(addr addrs.Provider) bool

func (ProviderFactories) NewInstance

func (p ProviderFactories) NewInstance(addr addrs.Provider) (providers.Interface, error)

type ProviderLaunchers added in v0.22.0

type ProviderLaunchers map[addrs.Provider]providers.Launcher

ProviderLaunchers are the context-taking forms of some of a library's provider factories. See providers.Launcher.

type ProviderManager

type ProviderManager interface {
	// HasProvider checks to see if the underlying library contains a given provider.
	HasProvider(addr addrs.Provider) bool

	// GetProviderSchema returns a fully validated and cached provider schema. This should
	// always be preferred to accessing the schema directly from a provider.
	GetProviderSchema(ctx context.Context, addr addrs.Provider) (providers.ProviderSchema, tfdiags.Diagnostics)

	// NewProvider starts and tracks a new provider instance of the given type.
	NewProvider(ctx context.Context, addr addrs.Provider) (providers.Interface, tfdiags.Diagnostics)
	// NewConfiguredProvider starts, configures, and tracks a new provider instance of the give type.
	NewConfiguredProvider(ctx context.Context, addr addrs.Provider, cfgVal cty.Value) (providers.Configured, tfdiags.Diagnostics)

	// StopAll gracefully requests all tracked providers to stop.
	// See [providers.Unconfigured.Stop] for more information.
	StopAll(context.Context) error
	// CloseAll forcefully closes all tracked providers.
	// See [providers.Unconfigured.Close] for more information.
	// Every tofu.Context owns one manager of each kind and its owner calls
	// (*tofu.Context).Close, which calls Shutdown. plugin.CleanupClients in
	// cmd/choudoufu/main.go remains only as a backstop for a process that
	// exits without reaching that Close (a forced interrupt, a panic).
	CloseAll(context.Context) error
	// Shutdown locks the provider manager in a Shutdown state and calls CloseAll,
	// preventing any further usage of this object.
	Shutdown(context.Context) error
}

ProviderManager allows for spawning, tracking and management of provider instances.

type ProvisionerFactories

type ProvisionerFactories map[string]provisioners.Factory

func (ProvisionerFactories) HasProvisioner

func (p ProvisionerFactories) HasProvisioner(typ string) bool

func (ProvisionerFactories) NewInstance

func (p ProvisionerFactories) NewInstance(typ string) (provisioners.Interface, error)

type ProvisionerManager

type ProvisionerManager interface {
	// HasProvisioner checks to see if the underlying library contains a given provisioner.
	HasProvisioner(typ string) bool

	// ProvisionerSchema is a caching wrapper for [provisioners.Interface.GetSchema]
	ProvisionerSchema(typ string) (*configschema.Block, error)
	// [provisioners.Interface.ValidateProvisionerConfig]
	ValidateProvisionerConfig(ctx context.Context, typ string, config cty.Value) tfdiags.Diagnostics
	// [provisioners.Interface.ProvisionResource]
	ProvisionResource(ctx context.Context, typ string, config cty.Value, connection cty.Value, output provisioners.UIOutput) tfdiags.Diagnostics

	// StopAll gracefully requests all tracked provisioners to stop.
	// See [provisioners.Interface.Stop] for more information.
	StopAll() error
	// CloseAll forcefully closes all tracked provisioners.
	// See [provisioners.Interface.Close] for more information.
	// Every tofu.Context owns one manager of each kind and its owner calls
	// (*tofu.Context).Close, which calls Shutdown. plugin.CleanupClients in
	// cmd/choudoufu/main.go remains only as a backstop for a process that
	// exits without reaching that Close (a forced interrupt, a panic).
	CloseAll() error
	// Shutdown locks the provisioner manager in a Shutdown state and calls CloseAll,
	// preventing any further usage of this object.
	Shutdown() error
}

ProvisionerManager exposes provisioner functionality through functions, instead of providing access to the provisioner instances themselves.

Jump to

Keyboard shortcuts

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