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.
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
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.
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.