utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HCL

func HCL(v interface{}) ([]byte, error)

HCL returns the configuration in HCL format. Required to generate the Terraform variables file

func Map

func Map(v interface{}) map[string]interface{}

Map returns a map[string]interface type with all the variables. The keys in the map are the name of the json tag

func NewTerraformer

func NewTerraformer(code []byte, variables map[string]interface{}, state *terraformer.State, clusterName string, platform string, ui *ui.UI) (*terraformer.Terraformer, error)

NewTerraformer creates and returns a terraformer to be used by a provisioner

func RemoveEnv

func RemoveEnv(envConfig map[string]string, prefixes ...string) (map[string]string, map[string]string)

RemoveEnv removes the environment variables with the given prefix, it returns whatever was removed

func TrimLeft

func TrimLeft(envConfig map[string]string, prefix string) map[string]string

TrimLeft removes the given prefix from the keys of the given map with environment variables

Types

type StateHook

type StateHook struct {
	terraform.NilHook
	sync.Mutex

	StateMgr statemgr.Writer
}

StateHook is a hook that continuously updates the state by calling WriteState on a state.State.

func (*StateHook) PostStateUpdate

func (h *StateHook) PostStateUpdate(new *states.State) (terraform.HookAction, error)

PostStateUpdate is call after the state is updated.

type UIHook

type UIHook struct {
	terraform.NilHook
	// contains filtered or unexported fields
}

UIHook inherit from terraform.NilHook and implement terraform.Hook which is the interface that must be implemented to hook into various parts of Terraform, allowing you to inspect or change behavior at runtime.

func NewUIHook

func NewUIHook(platform string, ui *ui.UI) *UIHook

NewUIHook returns a new LogHook which is the default Hook

func (*UIHook) PostApply

func (h *UIHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation, newState cty.Value, applyerr error) (terraform.HookAction, error)

PostApply is called after a single resource is applied. The error argument in PostApply is the error, if any, that was returned from the provIDer Apply call itself.

func (*UIHook) PostImportState

func (h *UIHook) PostImportState(addr addrs.AbsResourceInstance, imported []providers.ImportedResource) (terraform.HookAction, error)

PostImportState is called after a single resource's state is being improted.

func (*UIHook) PreApply

func (h *UIHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation, action plans.Action, priorState, plannedNewState cty.Value) (terraform.HookAction, error)

PreApply is called before a single resource is applied.

func (*UIHook) PreImportState

func (h *UIHook) PreImportState(addr addrs.AbsResourceInstance, importID string) (terraform.HookAction, error)

PreImportState is called before a single resource's state is being improted.

func (*UIHook) PreProvisionInstanceStep

func (h *UIHook) PreProvisionInstanceStep(addr addrs.AbsResourceInstance, typeName string) (terraform.HookAction, error)

PreProvisionInstanceStep should be self-explanatory

func (*UIHook) PreRefresh

func (h *UIHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (terraform.HookAction, error)

PreRefresh is called before a single resource state is refreshed.

func (*UIHook) ProvisionOutput

func (h *UIHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string, msg string)

ProvisionOutput is called with output sent back by the provisioners. This will be called multiple times as output comes in, but each call should represent a line of output. The ProvisionOutput method cannot control whether the hook continues running.

Jump to

Keyboard shortcuts

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