provider

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: MIT Imports: 21 Imported by: 2

Documentation

Overview

Package provider implements a client to call import, read, and destroy on any Terraform provider Plugin via GRPC.

Index

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, versionConstraint, installDir string) (discovery.PluginMeta, error)

Install installs a Terraform Provider Plugin binary with a given version. For example, call:

Install("aws", "2.43.0", "~/.terradozer")

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 added in v0.1.3

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

func (p TerraformProvider) ReadResource(terraformType string, state cty.Value) (cty.Value, error)

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.

Jump to

Keyboard shortcuts

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