provisioners

package
v0.0.0-...-c924774 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package provisioners contains the interface and primary types to implement a OpenTofu resource provisioner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory func() (Interface, error)

Factory is a function type that creates a new instance of a resource provisioner, or returns an error if that is impossible.

func FactoryFixed

func FactoryFixed(p Interface) Factory

FactoryFixed is a helper that creates a Factory that just returns some given single provisioner.

Unlike usual factories, the exact same instance is returned for each call to the factory and so this must be used in only specialized situations where the caller can take care to either not mutate the given provider at all or to mutate it in ways that will not cause unexpected behavior for others holding the same reference.

type GetSchemaResponse

type GetSchemaResponse struct {
	// Provisioner contains the schema for this provisioner.
	Provisioner *configschema.Block

	// Diagnostics contains any warnings or errors from the method call.
	Diagnostics tfdiags.Diagnostics
}

type Interface

type Interface interface {
	// GetSchema returns the schema for the provisioner configuration.
	GetSchema() GetSchemaResponse

	// ValidateProvisionerConfig allows the provisioner to validate the
	// configuration values.
	ValidateProvisionerConfig(ValidateProvisionerConfigRequest) ValidateProvisionerConfigResponse

	// ProvisionResource runs the provisioner with provided configuration.
	// ProvisionResource blocks until the execution is complete.
	// If the returned diagnostics contain any errors, the resource will be
	// left in a tainted state.
	ProvisionResource(ProvisionResourceRequest) ProvisionResourceResponse

	// Stop is called to interrupt the provisioner.
	//
	// Stop should not block waiting for in-flight actions to complete. It
	// should take any action it wants and return immediately acknowledging it
	// has received the stop request. OpenTofu will not make any further API
	// calls to the provisioner after Stop is called.
	//
	// The error returned, if non-nil, is assumed to mean that signaling the
	// stop somehow failed and that the user should expect potentially waiting
	// a longer period of time.
	Stop() error

	// Close shuts down the plugin process if applicable.
	Close() error
}

Interface is the set of methods required for a resource provisioner plugin.

type ProvisionResourceRequest

type ProvisionResourceRequest struct {
	// Config is the complete provisioner configuration.
	Config cty.Value

	// Connection contains any information required to access the resource
	// instance.
	Connection cty.Value

	// UIOutput is used to return output during the Apply operation.
	UIOutput UIOutput
}

type ProvisionResourceResponse

type ProvisionResourceResponse struct {
	// Diagnostics contains any warnings or errors from the method call.
	Diagnostics tfdiags.Diagnostics
}

type UIOutput

type UIOutput interface {
	Output(string)
}

UIOutput provides the Output method for resource provisioner plugins to write any output to the UI.

Provisioners may call the Output method multiple times while Apply is in progress. It is invalid to call Output after Apply returns.

type ValidateProvisionerConfigRequest

type ValidateProvisionerConfigRequest struct {
	// Config is the complete configuration to be used for the provisioner.
	Config cty.Value
}

type ValidateProvisionerConfigResponse

type ValidateProvisionerConfigResponse struct {
	// Diagnostics contains any warnings or errors from the method call.
	Diagnostics tfdiags.Diagnostics
}

Jump to

Keyboard shortcuts

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