plugin

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 16 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

Overview

Package plugin starts provider plugins built for OpenTofu or Terraform and talks to them over plugin protocol 5 or 6, whichever the provider speaks.

Index

Constants

This section is empty.

Variables

View Source
var TerraformVersion = "1.12.0"

TerraformVersion is reported to providers when they are configured. Some providers put it into their User-Agent or refuse very old versions.

Functions

This section is empty.

Types

type Diagnostic

type Diagnostic struct {
	Error   bool
	Summary string
	Detail  string
	// Path is empty when the diagnostic is not about one attribute.
	Path []PathStep
}

Diagnostic is an error or a warning reported by a provider.

type ImportedResource

type ImportedResource struct {
	TypeName string
	State    cty.Value
	Private  []byte
}

ImportedResource is one object returned by ImportResourceState. Importing a single ID can yield several objects, for example a security group and its rules.

type ListedResource

type ListedResource struct {
	DisplayName string
	// Object is the full resource, or null when it was not requested or the
	// provider did not send it.
	Object cty.Value
}

ListedResource is one object found by ListResource.

type Options

type Options struct {
	// Logger receives the plugin's log output. Nil keeps it quiet.
	Logger hclog.Logger
}

Options tweak how the plugin process is started.

type PathStep

type PathStep struct {
	Attribute string
	Key       string
	Index     int64
	IsKey     bool
	IsIndex   bool
}

PathStep is one step of the attribute path a diagnostic points at: an attribute name, a map key or a list index.

type Provider

type Provider struct {
	Path     string
	Protocol int
	// contains filtered or unexported fields
}

Provider is a running provider plugin.

func Start

func Start(path string, opts Options) (*Provider, error)

Start launches the provider binary at path and negotiates a protocol.

func (*Provider) Close

func (p *Provider) Close()

Close stops the plugin process.

func (*Provider) Configure

func (p *Provider) Configure(ctx context.Context, config cty.Value) error

Configure passes the provider configuration. Attributes missing from config are sent as null, the same as when they are omitted in HCL.

func (*Provider) ImportResourceState

func (p *Provider) ImportResourceState(ctx context.Context, typeName, id string) ([]ImportedResource, error)

ImportResourceState asks the provider to adopt the object with the given import ID, exactly as an `import` block would.

func (*Provider) ListResource

func (p *Provider) ListResource(ctx context.Context, typeName string, config cty.Value, includeResource bool, limit int64) ([]ListedResource, []Diagnostic, error)

ListResource asks the provider for existing objects of a resource type that has a list resource, the mechanism behind Terraform's `query` command. config follows the list resource's own schema (filters and the like); missing attributes are null. Objects whose event carried an error are skipped; all diagnostics are returned.

func (*Provider) ReadResource

func (p *Provider) ReadResource(ctx context.Context, typeName string, state cty.Value, private []byte) (cty.Value, []byte, error)

ReadResource refreshes an object from the remote API. A null result means the object no longer exists.

func (*Provider) Schema

func (p *Provider) Schema(ctx context.Context) (*schema.Provider, error)

Schema returns the provider's schema, fetching it on first use.

func (*Provider) ValidateResourceConfig

func (p *Provider) ValidateResourceConfig(ctx context.Context, typeName string, config cty.Value) ([]Diagnostic, error)

ValidateResourceConfig checks a resource configuration the way `tofu validate` does, including rules the schema cannot express, such as arguments that conflict with or require each other. config must conform to the resource type's schema; unknown values stand for references.

Jump to

Keyboard shortcuts

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