terraform

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(t *testing.T, options *Options) string

Run terraform apply with the given options and return stdout/stderr. Note that this method does NOT call destroy and assumes the caller is responsible for cleaning up any resources created by running apply.

func ApplyE

func ApplyE(t *testing.T, options *Options) (string, error)

Run terraform apply with the given options and return stdout/stderr. Note that this method does NOT call destroy and assumes the caller is responsible for cleaning up any resources created by running apply.

func Destroy

func Destroy(t *testing.T, options *Options) string

Run terraform destroy with the given options and return stdout/stderr.

func DestroyE

func DestroyE(t *testing.T, options *Options) (string, error)

Run terraform destroy with the given options and return stdout/stderr.

func FormatArgs

func FormatArgs(customVars map[string]interface{}, args ...string) []string

Convert the inputs to a format palatable to terraform. This includes converting the given vars to the format the Terraform CLI expects (-var key=value).

func FormatTerraformVarsAsArgs

func FormatTerraformVarsAsArgs(vars map[string]interface{}) []string

Format the given variables as command-line args for Terraform (e.g. of the format -var key=value).

func Get

func Get(t *testing.T, options *Options) string

Call terraform get and return stdout/stderr

func GetE

func GetE(t *testing.T, options *Options) (string, error)

Call terraform get and return stdout/stderr

func Init

func Init(t *testing.T, options *Options) string

Call terraform init and return stdout/stderr

func InitAndApply

func InitAndApply(t *testing.T, options *Options) string

Run terraform init and apply with the given options and return stdout/stderr from the apply command. Note that this method does NOT call destroy and assumes the caller is responsible for cleaning up any resources created by running apply.

func InitAndApplyE

func InitAndApplyE(t *testing.T, options *Options) (string, error)

Run terraform init and apply with the given options and return stdout/stderr from the apply command. Note that this method does NOT call destroy and assumes the caller is responsible for cleaning up any resources created by running apply.

func InitE

func InitE(t *testing.T, options *Options) (string, error)

Call terraform init and return stdout/stderr

func Output

func Output(t *testing.T, options *Options, key string) string

Call terraform output for the given variable and return its value

func OutputE

func OutputE(t *testing.T, options *Options, key string) (string, error)

Call terraform output for the given variable and return its value

func OutputRequired

func OutputRequired(t *testing.T, options *Options, key string) string

Call terraform output for the given variable and return its value. If the value is empty, fail the test.

func OutputRequiredE

func OutputRequiredE(t *testing.T, options *Options, key string) (string, error)

Call terraform output for the given variable and return its value. If the value is empty, return an error.

Types

type EmptyOutput

type EmptyOutput string

func (EmptyOutput) Error

func (outputName EmptyOutput) Error() string

type Options

type Options struct {
	TerraformDir             string                 // The path to the folder where the Terraform code is defined.
	Vars                     map[string]interface{} // The vars to pass to Terraform commands using the -var option.
	RetryableTerraformErrors map[string]string      // If Terraform apply fails with one of these (transient) errors, retry. The keys are text to look for in the error and the message is what to display to a user if that error is found.
	MaxRetries               int                    // Maximum number of times to retry errors matching RetryableTerraformErrors
	TimeBetweenRetries       time.Duration          // The amount of time to wait between retries
}

Options for running Terraform commands

Jump to

Keyboard shortcuts

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