testing

package
v0.0.0-...-d3a155b Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestTerraformer

type TestTerraformer struct {
	// contains filtered or unexported fields
}

TestTerraformer is an object representing the lifecycle of a particular Terraform project.

Note that Terraform must be installed in the system PATH (not to be confused with the working directory below). This object does not manage anything with regards to installation or version management.

func NewTestTerraformer

func NewTestTerraformer(workDir string) (*TestTerraformer, error)

NewTestTerraformer initializes a Terraform directory. It just returns an initialized project, it does not perform any actions on it.

func (*TestTerraformer) Deploy

func (t *TestTerraformer) Deploy() error

Deploy runs the following commands, in order: init, apply, plan, json. The output of the JSON command is then imported to the internal state.

func (*TestTerraformer) Destroy

func (t *TestTerraformer) Destroy() error

Destroy runs the following commands, in order: init, destroy. The state is also cleared.

func (*TestTerraformer) GetOutput

func (t *TestTerraformer) GetOutput(key string) (any, error)

GetOutput returns the value of the output located at key.

Outputs for the root module are supported only. It's an error to run this when no state exists.

func (*TestTerraformer) GetOutputMap

func (t *TestTerraformer) GetOutputMap(key string) (map[string]any, error)

GetOutputMap wraps GetOutput and returns the value as a map. It's an error if the return value is actually not a map.

func (*TestTerraformer) GetOutputSlice

func (t *TestTerraformer) GetOutputSlice(key string) ([]any, error)

GetOutputSlice wraps GetOutput and returns the value as a slice. It's an error if the return value is actually not a slice.

func (*TestTerraformer) GetOutputString

func (t *TestTerraformer) GetOutputString(key string) (string, error)

GetOutputString wraps GetOutput and returns the value as a string. It's an error if the return value is actually not a string.

Jump to

Keyboard shortcuts

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