terraform

package
v0.0.0-...-982cc4c Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigVariables

type ConfigVariables map[string]interface{}

ConfigVariables represents values for Terraform configuration variables, keyed by name.

func (ConfigVariables) Clear

func (variables ConfigVariables) Clear()

Clear the contents of the variable map.

func (ConfigVariables) Read

func (variables ConfigVariables) Read(fileName string) error

Read variables from the specified file (normally tfvars.json).

This operation is additive but does not overwrite existing values. Call Clear before Read if this isn't what you want.

func (ConfigVariables) Write

func (variables ConfigVariables) Write(fileName string) error

Save variables from the specified file (normally tfvars.json).

type Output

type Output struct {
	Name      string      `json:""`
	DataType  string      `json:"type"`
	Value     interface{} `json:"value"`
	Sensitive bool        `json:"sensitive"`
}

Output represents an output from Terraform's "output" command.

type Outputs

type Outputs map[string]Output

Outputs is a map of Terraform outputs, keyed by name.

type PipeHandler

type PipeHandler func(string)

PipeHandler is a function which receives lines of piped output from Terraform as they become available

type Terraformer

type Terraformer struct {
	// The path to the Terraform executable
	ExecutablePath string

	// The directory containing the Terraform configuration
	ConfigDir string
}

Terraformer is used to invoke Terraform.

func New

func New(configDir string) (*Terraformer, error)

New creates a new Terraformer using the specified configuration directory.

func NewWithExecutable

func NewWithExecutable(executablePath string, configDir string) (*Terraformer, error)

NewWithExecutable creates a new Terraformer using the specified Terraform executable and configuration directory.

func (*Terraformer) Apply

func (terraformer *Terraformer) Apply() (success bool, err error)

Apply invokes Terraform's "apply" command.

func (*Terraformer) Destroy

func (terraformer *Terraformer) Destroy() (success bool, err error)

Destroy invokes Terraform's "destroy" command.

func (*Terraformer) Get

func (terraformer *Terraformer) Get() error

Get invokes Terraform's "get" command.

func (*Terraformer) Output

func (terraformer *Terraformer) Output() (outputs Outputs, err error)

Output invokes Terraform's "output" command and parse the results.

Returns a map of outputs, keyed by name.

func (*Terraformer) Refresh

func (terraformer *Terraformer) Refresh() error

Refresh invokes Terraform's "refresh" command.

func (*Terraformer) Run

func (terraformer *Terraformer) Run(command string, arguments ...string) (success bool, output string, err error)

Run invokes Terraform.

command is the name of the Terraform command to execute (e.g. plan, apply, output, destroy, etc) arguments are any other arguments to pass to Terraform

func (*Terraformer) RunStreamed

func (terraformer *Terraformer) RunStreamed(command string, arguments ...string) (success bool, err error)

RunStreamed invokes Terraform and streams its output to the Docker Machine log.

command is the name of the Terraform command to execute (e.g. plan, apply, output, destroy, etc) arguments are any other arguments to pass to Terraform

func (*Terraformer) RunStreamedWithHandler

func (terraformer *Terraformer) RunStreamedWithHandler(command string, handler PipeHandler, arguments ...string) (success bool, err error)

RunStreamedWithHandler invokes Terraform and pipes its output to the specified OutputHandler.

command is the name of the Terraform command to execute (e.g. plan, apply, output, destroy, etc) pipeOutput is a function called once for each line of output received arguments are any other arguments to pass to Terraform

func (*Terraformer) Validate

func (terraformer *Terraformer) Validate() error

Validate invokes Terraform's "validate" command and parse the results.

Returns a map of outputs, keyed by name.

Jump to

Keyboard shortcuts

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