{"modulePath":"github.com/windsorcli/cli","version":"v0.7.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package stack\n\n## Types\n\n```go\ntype BaseStack struct {\n\t// contains filtered or unexported fields\n}\n```\nBaseStack is a struct that implements the Stack interface.\n\n```go\nfunc NewBaseStack(injector di.Injector) *BaseStack\n```\nNewBaseStack creates a new base stack of components.\n\n```go\nfunc (s *BaseStack) Down() error\n```\nDown destroys a stack of components.\n\n```go\nfunc (s *BaseStack) Initialize() error\n```\nInitialize initializes the stack of components.\n\n```go\nfunc (s *BaseStack) Up() error\n```\nUp creates a new stack of components.\n\n```go\ntype MockStack struct {\n\tInitializeFunc func() error\n\tUpFunc         func() error\n\tDownFunc       func() error\n}\n```\nMockStack is a mock implementation of the Stack interface for testing.\n\n```go\nfunc NewMockStack(injector di.Injector) *MockStack\n```\nNewMockStack creates a new mock stack.\n\n```go\nfunc (m *MockStack) Down() error\n```\nDown is a mock implementation of the Down method.\n\n```go\nfunc (m *MockStack) Initialize() error\n```\nInitialize is a mock implementation of the Initialize method.\n\n```go\nfunc (m *MockStack) Up() error\n```\nUp is a mock implementation of the Up method.\n\n```go\ntype Shims struct {\n\tStat     func(string) (os.FileInfo, error)\n\tChdir    func(string) error\n\tGetwd    func() (string, error)\n\tSetenv   func(string, string) error\n\tUnsetenv func(string) error\n\tRemove   func(string) error\n}\n```\nShims provides mockable wrappers around system and runtime functions\n\n```go\nfunc NewShims() *Shims\n```\nNewShims creates a new Shims instance with default implementations\n\n```go\ntype Stack interface {\n\tInitialize() error\n\tUp() error\n\tDown() error\n}\n```\nStack is an interface that represents a stack of components.\n\n```go\ntype WindsorStack struct {\n\tBaseStack\n\t// contains filtered or unexported fields\n}\n```\nWindsorStack is a struct that implements the Stack interface.\n\n```go\nfunc NewWindsorStack(injector di.Injector) *WindsorStack\n```\nNewWindsorStack creates a new WindsorStack.\n\n```go\nfunc (s *WindsorStack) Down() error\n```\nDown 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.\n\n```go\nfunc (s *WindsorStack) Initialize() error\n```\nInitialize initializes the WindsorStack by calling the base Initialize and resolving terraform environment.\n\n```go\nfunc (s *WindsorStack) Up() error\n```\nUp 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.\n\n","path":"github.com/windsorcli/cli/pkg/stack","name":"stack","synopsis":"","isRedistributable":true}
