terraform

package
v0.0.0-...-75c6b3a Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: MIT Imports: 12 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Services = map[string]string{}/* 729 elements not displayed */

Services contains the name of the AWS service that each resource type belongs to.

View Source
var Types = []string{}/* 730 elements not displayed */

Types is a list of all resource types implemented by the Terraform AWS Provider.

Functions

func IsType

func IsType(s string) bool

IsType returns true if the given string is a Terraform AWS resource type.

func NewProviderPool

func NewProviderPool(ctx context.Context, clientKeys []aws.ClientKey, version, installDir string,
	timeout time.Duration) (
	map[aws.ClientKey]provider.TerraformProvider, error)

NewProviderPool launches a set of Terraform AWS Providers with the configuration of the given clientKeys (combination of AWS profile and region). Providers are launched only once in case of duplicate clientKeys.

Types

type Resource

type Resource struct {
	// Type is a resource's type as defined by the Terraform AWS Provider (e.g., aws_instance).
	Type string
	// ID is a resource's ID as defined by the Terraform AWS Provider. Depending on the resource type, the ID can be
	// the ARN, name (for aws_iam_role), or combined string of different attributes. The Terraform ID can differ from
	// what AWS defines as ID and from what ID is returned via the AWS SDK.
	ID string
	// The AWS region where a resource lives in.
	Region    string
	Profile   string
	AccountID string
	Tags      map[string]string
	CreatedAt *time.Time

	// Provider is the Terraform Provider to update the state of a resource
	Provider *provider.TerraformProvider
	// State is the Terraform state of the resource
	State *cty.Value
	Attrs map[string]cty.Value
}

func UpdateStates

func UpdateStates(resources []Resource, providers map[aws.ClientKey]provider.TerraformProvider,
	parallel int, existingOnly bool) ([]Resource, []error)

UpdateStates updates the Terraform state for each resource via the Terraform AWS Provider. Returns only resources for which an update was successful. Errors about failed updates are returned via []error. If the existingOnly flag is true, only existing resources are returned (i.e. which state isn't of type cty.Nil after update).

func (*Resource) UpdateState

func (r *Resource) UpdateState() error

UpdateState updates the state of the resource (i.e., refreshes all its attributes). If the resource is already gone, the updated state will be nil (more precisely, of type cty.NilVal).

type ResourcesThreadSafe

type ResourcesThreadSafe struct {
	sync.Mutex
	Resources []Resource
	Errors    []error
}

ResourcesThreadSafe is a list implementation to store resources concurrently.

type UpdatableResource

type UpdatableResource interface {
	Type() string
	ID() string
	State() *cty.Value
	UpdateState() error
}

UpdatableResource implementations can update a Terraform resource's state.

func UpdateResources

func UpdateResources(resources []UpdatableResource, parallel int) []UpdatableResource

UpdateResources updates the state of a given list of resources in parallel. Only updated resources are returned which still exist in AWS.

Directories

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

Jump to

Keyboard shortcuts

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