Documentation
¶
Overview ¶
Package tofu provides OpenTofu execution capabilities.
Index ¶
- func BinaryName() string
- func DefaultBinary() string
- func EnsureStateDir(baseDir string) error
- func HasTerraformFiles(dir string) (bool, error)
- func IsTimeoutError(err error) bool
- func PackagedBinaryPath() (string, bool)
- func ValidateWorkDir(dir string) error
- type Executor
- func (e *Executor) Apply(ctx context.Context, planFile string) (*Result, error)
- func (e *Executor) Destroy(ctx context.Context) (*Result, error)
- func (e *Executor) Format(ctx context.Context) (*Result, error)
- func (e *Executor) GetWorkDir() string
- func (e *Executor) Graph(ctx context.Context) (*Result, error)
- func (e *Executor) Import(ctx context.Context, address, id string) (*Result, error)
- func (e *Executor) Init(ctx context.Context) (*Result, error)
- func (e *Executor) IsInstalled() bool
- func (e *Executor) Output(ctx context.Context) (*Result, error)
- func (e *Executor) Plan(ctx context.Context, outFile string, destroy bool) (*Result, error)
- func (e *Executor) Providers(ctx context.Context) (*Result, error)
- func (e *Executor) Refresh(ctx context.Context) (*Result, error)
- func (e *Executor) SetAutoApprove(autoApprove bool)
- func (e *Executor) SetWorkDir(dir string)
- func (e *Executor) Show(ctx context.Context, planFile string) (*Result, error)
- func (e *Executor) State(ctx context.Context) (*Result, error)
- func (e *Executor) Taint(ctx context.Context, address string) (*Result, error)
- func (e *Executor) Untaint(ctx context.Context, address string) (*Result, error)
- func (e *Executor) Validate(ctx context.Context) (*Result, error)
- func (e *Executor) Version(ctx context.Context) (string, error)
- type ExecutorOption
- type PlanChanges
- type Result
- type TimeoutError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryName ¶
func BinaryName() string
BinaryName returns the OpenTofu executable name for the current platform.
func DefaultBinary ¶
func DefaultBinary() string
DefaultBinary resolves the OpenTofu binary used by regular execution. It intentionally avoids PATH fallback so a host-installed OpenTofu cannot make StackKit appear release-ready when the package is missing its own copy.
func EnsureStateDir ¶
EnsureStateDir ensures the state directory exists
func HasTerraformFiles ¶
HasTerraformFiles checks if directory contains .tf files
func IsTimeoutError ¶
IsTimeoutError checks if an error is a timeout error
func PackagedBinaryPath ¶
PackagedBinaryPath returns the StackKit-packaged OpenTofu binary path. It intentionally does not fall back to PATH: product and release tests must prove that OpenTofu ships with StackKit, not that the host happens to have it.
func ValidateWorkDir ¶
ValidateWorkDir validates the working directory
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor handles OpenTofu command execution
func NewExecutor ¶
func NewExecutor(opts ...ExecutorOption) *Executor
NewExecutor creates a new OpenTofu executor
func (*Executor) GetWorkDir ¶
GetWorkDir returns the working directory
func (*Executor) IsInstalled ¶
IsInstalled checks if tofu is installed
func (*Executor) SetAutoApprove ¶
SetAutoApprove sets the auto-approve flag dynamically
func (*Executor) SetWorkDir ¶
SetWorkDir sets the working directory
type ExecutorOption ¶
type ExecutorOption func(*Executor)
ExecutorOption configures the Executor
func WithAutoApprove ¶
func WithAutoApprove(autoApprove bool) ExecutorOption
WithAutoApprove enables auto-approve for apply/destroy
func WithBinary ¶
func WithBinary(binary string) ExecutorOption
WithBinary sets the tofu binary path
func WithEnv ¶
func WithEnv(values ...string) ExecutorOption
WithEnv appends environment values for OpenTofu commands.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ExecutorOption
WithTimeout sets the execution timeout
func WithWorkDir ¶
func WithWorkDir(dir string) ExecutorOption
WithWorkDir sets the working directory
type PlanChanges ¶
PlanChanges represents changes detected by plan
func ParsePlanOutput ¶
func ParsePlanOutput(output string) *PlanChanges
ParsePlanOutput parses plan output to extract changes
type TimeoutError ¶
TimeoutError represents a command timeout
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string