terraform

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockStack

type MockStack struct {
	UpFunc   func(blueprint *blueprintv1alpha1.Blueprint) error
	DownFunc func(blueprint *blueprintv1alpha1.Blueprint) error
}

MockStack is a mock implementation of the Stack interface for testing.

func NewMockStack

func NewMockStack() *MockStack

NewMockStack creates a new mock stack.

func (*MockStack) Down

func (m *MockStack) Down(blueprint *blueprintv1alpha1.Blueprint) error

Down is a mock implementation of the Down method.

func (*MockStack) Up

func (m *MockStack) Up(blueprint *blueprintv1alpha1.Blueprint) error

Up is a mock implementation of the Up method.

type Shims

type Shims struct {
	Stat     func(string) (os.FileInfo, error)
	Chdir    func(string) error
	Getwd    func() (string, error)
	Setenv   func(string, string) error
	Unsetenv func(string) error
	Remove   func(string) error
}

Shims provides mockable wrappers around system and runtime functions

func NewShims

func NewShims() *Shims

NewShims creates a new Shims instance with default implementations

type Stack

type Stack interface {
	Up(blueprint *blueprintv1alpha1.Blueprint) error
	Down(blueprint *blueprintv1alpha1.Blueprint) error
}

Stack defines the interface for Terraform stack operations. Both the Stack struct and MockStack implement this interface.

func NewStack

func NewStack(rt *runtime.Runtime, opts ...*TerraformStack) Stack

NewStack creates a new stack of components.

type TerraformStack

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

TerraformStack manages Terraform infrastructure components by initializing and applying Terraform configurations. It processes components in order, generating terraform arguments, running Terraform init, plan, and apply operations.

func (*TerraformStack) Down

func (s *TerraformStack) Down(blueprint *blueprintv1alpha1.Blueprint) error

Down destroys all Terraform components in the stack by executing Terraform destroy operations in reverse dependency order. For each component, Down generates Terraform arguments, sets required environment variables, unsets conflicting TF_CLI_ARGS_* variables, creates backend override files, runs Terraform refresh, plan (with destroy flag), and destroy commands, and removes backend override files. Components with Destroy set to false are skipped. Directory state is restored after execution. Errors are returned on any operation failure. The blueprint parameter is required to resolve terraform components.

func (*TerraformStack) Up

func (s *TerraformStack) Up(blueprint *blueprintv1alpha1.Blueprint) error

Up creates a new stack of components by initializing and applying Terraform configurations. It processes components in order, generating terraform arguments, running Terraform init, plan, and apply operations, and cleaning up backend override files. The method ensures proper directory management and terraform argument setup for each component. The blueprint parameter is required to resolve terraform components.

Jump to

Keyboard shortcuts

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