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 ¶
- Variables
- type Diagnostic
- type ImportedResource
- type ListedResource
- type Options
- type PathStep
- type Provider
- func (p *Provider) Close()
- func (p *Provider) Configure(ctx context.Context, config cty.Value) error
- func (p *Provider) ImportResourceState(ctx context.Context, typeName, id string) ([]ImportedResource, error)
- func (p *Provider) ListResource(ctx context.Context, typeName string, config cty.Value, includeResource bool, ...) ([]ListedResource, []Diagnostic, error)
- func (p *Provider) ReadResource(ctx context.Context, typeName string, state cty.Value, private []byte) (cty.Value, []byte, error)
- func (p *Provider) Schema(ctx context.Context) (*schema.Provider, error)
- func (p *Provider) ValidateResourceConfig(ctx context.Context, typeName string, config cty.Value) ([]Diagnostic, error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
PathStep is one step of the attribute path a diagnostic points at: an attribute name, a map key or a list index.
type Provider ¶
Provider is a running provider plugin.
func (*Provider) Configure ¶
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) 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.