Documentation ¶
Overview ¶
Package provider implements a client to call import, read, and destroy on any Terraform provider Plugin via GRPC.
Index ¶
- func InitProviders(providerNames []string, installDir string, timeout time.Duration) (map[string]*TerraformProvider, error)
- func Install(providerName, providerVersion, installDir string) (discovery.PluginMeta, error)
- type TerraformProvider
- func (p TerraformProvider) Close() error
- func (p TerraformProvider) Configure(config cty.Value) error
- func (p TerraformProvider) DestroyResource(terraformType string, currentState cty.Value) error
- func (p TerraformProvider) GetSchemaForResource(terraformType string) (providers.Schema, error)
- func (p TerraformProvider) ImportResource(terraformType string, id string) ([]providers.ImportedResource, error)
- func (p TerraformProvider) ReadResource(terraformType string, state cty.Value) (cty.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitProviders ¶
func InitProviders(providerNames []string, installDir string, timeout time.Duration) (map[string]*TerraformProvider, error)
InitProviders installs, launches (i.e., starts the plugin binary process), and configures a given list of Terraform Providers by name with a default configuration.
func Install ¶
func Install(providerName, providerVersion, installDir string) (discovery.PluginMeta, error)
Install installs a Terraform Provider Plugin binary with a given name and version. If the binary has already been installed previously, it isn't redownloaded. For example, call:
Install("aws", "2.43.0", "~/.my-aws-tool")
Types ¶
type TerraformProvider ¶
type TerraformProvider struct {
// contains filtered or unexported fields
}
func Init ¶
func Init(providerName string, installDir string, timeout time.Duration) (*TerraformProvider, error)
Init installs, launches (i.e., starts the plugin binary process), and configures a given Terraform Provider by name with a default configuration.
Note: Init() combines calls to the functions Install(), Launch(), and Configure(). Timeout is the amount of time to wait for a destroy operation of the provider to finish.
func Launch ¶
func Launch(pathToPluginExecutable string, timeout time.Duration) (*TerraformProvider, error)
Launch launches a Provider Plugin executable to provide the RPC server for this plugin. Timeout is the amount of time to wait for a destroy operation of the provider to finish.
func (TerraformProvider) Close ¶
func (p TerraformProvider) Close() error
Close shuts down the plugin process if applicable.
func (TerraformProvider) Configure ¶
func (p TerraformProvider) Configure(config cty.Value) error
Configure configures a provider.
func (TerraformProvider) DestroyResource ¶
func (p TerraformProvider) DestroyResource(terraformType string, currentState cty.Value) error
DestroyResource destroys a resource. This function requires the current state of a resource as input.
func (TerraformProvider) GetSchemaForResource ¶
func (p TerraformProvider) GetSchemaForResource(terraformType string) (providers.Schema, error)
GetSchemaForResource returns the schema for a specific resource type.
func (TerraformProvider) ImportResource ¶
func (p TerraformProvider) ImportResource(terraformType string, id string) ([]providers.ImportedResource, error)
ImportResource imports a Terraform resource by type and ID. Terraform Type and ID is the minimal information needed to uniquely identify a resource. For example, call:
ImportResource("aws_instance", "i-1234567890abcdef0")
The result is a resource which has only its ID set (all other attributes are empty).
func (TerraformProvider) ReadResource ¶
ReadResource refreshes all attributes of a given resource state. For example, this function can be used to populate all attributes of a resource after import.