terraform

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 18 Imported by: 74

Documentation

Overview

Package terraform contains the utilities that's used for invoking terraform executable under the given directory with the given templates.

Index

Constants

View Source
const StateFilename = "terraform.tfstate"

StateFilename is the default name of the terraform state file.

Variables

This section is empty.

Functions

func Apply

func Apply(dir string, platform string, stage Stage, terraformDir string, extraOpts ...tfexec.ApplyOption) error

Apply unpacks the platform-specific Terraform modules into the given directory and then runs 'terraform init' and 'terraform apply'.

func Destroy added in v0.3.0

func Destroy(dir string, platform string, stage Stage, terraformDir string, extraOpts ...tfexec.DestroyOption) error

Destroy unpacks the platform-specific Terraform modules into the given directory and then runs 'terraform init' and 'terraform destroy'.

func Outputs added in v0.9.2

func Outputs(dir string, terraformDir string) ([]byte, error)

Outputs reads the terraform state file and returns the outputs of the stage as json.

func UnpackTerraform added in v0.9.2

func UnpackTerraform(dir string, stages []Stage) error

UnpackTerraform unpacks the terraform binary and the specified provider binaries into the specified directory.

Types

type Stage added in v0.9.2

type Stage interface {
	// Name is the name of the stage.
	Name() string

	// StateFilename is the name of the terraform state file.
	StateFilename() string

	// OutputsFilename is the name of the outputs file for the stage.
	OutputsFilename() string

	// Providers is the list of providers that are used for the stage.
	Providers() []providers.Provider

	// DestroyWithBootstrap is true if the stage should be destroyed when destroying the bootstrap resources.
	DestroyWithBootstrap() bool

	// Destroy destroys the resources created in the stage. This should only be called if the stage should be destroyed
	// when destroying the bootstrap resources.
	Destroy(directory string, terraformDir string, varFiles []string) error

	// ExtractHostAddresses extracts the IPs of the bootstrap and control plane machines.
	ExtractHostAddresses(directory string, config *types.InstallConfig) (bootstrap string, port int, masters []string, err error)
}

Stage is an individual stage of terraform infrastructure provisioning.

Jump to

Keyboard shortcuts

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