plugins

package
v1.14.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MPL-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

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

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 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.
	// See cmd/bogform/main.go:plugin.CleanupClients for the fallback.
	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.
	// See cmd/bogform/main.go:plugin.CleanupClients for the fallback.
	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.

type Schemas

type Schemas struct {
	Providers    map[addrs.Provider]providers.ProviderSchema
	Provisioners map[string]*configschema.Block
}

Schemas is a container for various kinds of schema that Bogform needs during processing.

Although not all schemas necessarily come from plugins, this type lives here out of pragmatism because plugins are the most common place that schemas come from.

func (*Schemas) ProviderConfig

func (ss *Schemas) ProviderConfig(provider addrs.Provider) *configschema.Block

ProviderConfig returns the schema for the provider configuration of the given provider type, or nil if no such schema is available.

func (*Schemas) ProviderSchema

func (ss *Schemas) ProviderSchema(provider addrs.Provider) providers.ProviderSchema

ProviderSchema returns the entire ProviderSchema object that was produced by the plugin for the given provider, or nil if no such schema is available.

It's usually better to go use the more precise methods offered by type Schemas to handle this detail automatically.

func (*Schemas) ProvisionerConfig

func (ss *Schemas) ProvisionerConfig(name string) *configschema.Block

ProvisionerConfig returns the schema for the configuration of a given provisioner, or nil of no such schema is available.

func (*Schemas) ResourceTypeConfig

func (ss *Schemas) ResourceTypeConfig(provider addrs.Provider, resourceMode addrs.ResourceMode, resourceType string) (block *providers.Schema, schemaVersion uint64)

ResourceTypeConfig returns the schema for the configuration of a given resource type belonging to a given provider type, or nil of no such schema is available.

In many cases the provider type is inferable from the resource type name, but this is not always true because users can override the provider for a resource using the "provider" meta-argument. Therefore, it's important to always pass the correct provider name, even though it many cases it feels redundant.

Jump to

Keyboard shortcuts

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