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 ¶
- Variables
- func GetProviderSource(providerName string) string
- func GetProviderVersion(providerName string) string
- func IsLegacySDKResource(b *schema.Block) bool
- func StateFromValue(v cty.Value, schemaVersion int64) *legacy.InstanceState
- type ProviderWrapper
- func (p *ProviderWrapper) GetReadOnlyAttributes(resourceTypes []string) (map[string][]string, error)
- func (p *ProviderWrapper) GetSchema() *schema.Provider
- func (p *ProviderWrapper) GetZeroNumberAttributes(resourceTypes []string) map[string][]string
- func (p *ProviderWrapper) Kill()
- func (p *ProviderWrapper) ListResource(typeName string, limit int64) ([]plugin.ListedResource, []plugin.Diagnostic, error)
- func (p *ProviderWrapper) Refresh(info *legacy.InstanceInfo, state *legacy.InstanceState) (*legacy.InstanceState, error)
- func (p *ProviderWrapper) ValidateResourceConfig(typeName string, config cty.Value) ([]plugin.Diagnostic, error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
GetProviderSource returns the registry address to put in required_providers.
func GetProviderVersion ¶
GetProviderVersion returns a version constraint that matches the provider release the configuration was generated with, e.g. "~> 6.14".
func IsLegacySDKResource ¶
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 (*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 ¶
func (p *ProviderWrapper) Refresh(info *legacy.InstanceInfo, state *legacy.InstanceState) (*legacy.InstanceState, error)
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.