providerwrapper

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package providerwrapper runs one provider plugin for an import and hides the plugin protocol behind the flatmap-based API the importers expect.

Index

Constants

This section is empty.

Variables

View Source
var (
	// TFBinary is the tofu or terraform executable used to download
	// providers. Empty means look in PATH.
	TFBinary = os.Getenv("UNCLICK_TF_BINARY")
	// ProviderVersion constrains the provider release to download, for
	// example "~> 6.0". Empty means the newest one already installed, or the
	// newest one in the registry.
	ProviderVersion = ""
)

Settings that the command line passes down before any provider starts.

Functions

func GetProviderSource

func GetProviderSource(providerName string) string

GetProviderSource returns the registry address to put in required_providers.

func GetProviderVersion

func GetProviderVersion(providerName string) string

GetProviderVersion returns a version constraint that matches the provider release the configuration was generated with, e.g. "~> 6.14".

func IsLegacySDKResource

func IsLegacySDKResource(b *schema.Block) bool

IsLegacySDKResource recognizes SDKv2 resources by the "id" attribute the SDK adds to every resource as optional and computed. Plugin framework resources declare id themselves, as computed only.

func StateFromValue

func StateFromValue(v cty.Value, schemaVersion int64) *legacy.InstanceState

StateFromValue converts a resource object into the flatmap state the importers work with.

Types

type ProviderWrapper

type ProviderWrapper struct {
	// contains filtered or unexported fields
}

func NewProviderWrapper

func NewProviderWrapper(providerName string, providerConfig cty.Value, verbose bool, options ...map[string]int) (*ProviderWrapper, error)

func (*ProviderWrapper) GetReadOnlyAttributes

func (p *ProviderWrapper) GetReadOnlyAttributes(resourceTypes []string) (map[string][]string, error)

func (*ProviderWrapper) GetSchema

func (p *ProviderWrapper) GetSchema() *schema.Provider

GetSchema returns the provider schema. It panics if the provider cannot report one, because nothing else works without it and initProvider has already fetched it successfully.

func (*ProviderWrapper) GetZeroNumberAttributes

func (p *ProviderWrapper) GetZeroNumberAttributes(resourceTypes []string) map[string][]string

GetZeroNumberAttributes returns, per resource type, patterns for optional number attributes whose value 0 must not be written to configuration.

func (*ProviderWrapper) Kill

func (p *ProviderWrapper) Kill()

func (*ProviderWrapper) ListResource

func (p *ProviderWrapper) ListResource(typeName string, limit int64) ([]plugin.ListedResource, []plugin.Diagnostic, error)

ListResource returns the existing objects of a resource type that has a list resource, with their full state.

func (*ProviderWrapper) Refresh

Refresh reads the current attributes of a resource. Importers usually know only the ID and a few attributes, which is enough for the provider to look the object up. When reading fails, the object is imported by ID instead.

func (*ProviderWrapper) ValidateResourceConfig

func (p *ProviderWrapper) ValidateResourceConfig(typeName string, config cty.Value) ([]plugin.Diagnostic, error)

ValidateResourceConfig asks the provider to validate a resource body.

Jump to

Keyboard shortcuts

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