Documentation
¶
Overview ¶
Package terramate provides Terramate execution capabilities for Day 2 operations. Terramate enables drift detection, change sets, and orchestrated deployments.
Index ¶
- func BinaryName() string
- func CreateRootConfig(projectName string) string
- func CreateStackConfig(path, name, description string) string
- func DefaultBinary() string
- func PackagedBinaryPath() (string, bool)
- type Change
- type DriftResult
- type Executor
- func (e *Executor) DetectDrift(ctx context.Context) (*DriftResult, error)
- func (e *Executor) Generate(ctx context.Context) (*Result, error)
- func (e *Executor) Init(ctx context.Context) (*Result, error)
- func (e *Executor) IsInstalled() bool
- func (e *Executor) List(ctx context.Context) ([]Stack, error)
- func (e *Executor) ListChanged(ctx context.Context) ([]Stack, error)
- func (e *Executor) Output(ctx context.Context) (*Result, error)
- func (e *Executor) Refresh(ctx context.Context) (*Result, error)
- func (e *Executor) RunApply(ctx context.Context, autoApprove bool) (*Result, error)
- func (e *Executor) RunDestroy(ctx context.Context, autoApprove bool) (*Result, error)
- func (e *Executor) RunInit(ctx context.Context) (*Result, error)
- func (e *Executor) RunPlan(ctx context.Context) (*Result, error)
- func (e *Executor) Version(ctx context.Context) (string, error)
- type ExecutorOption
- type Result
- type Stack
- type StackDrift
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinaryName ¶
func BinaryName() string
BinaryName returns the Terramate executable name for the current platform.
func CreateRootConfig ¶
CreateRootConfig creates a root terramate.tm.hcl configuration
func CreateStackConfig ¶
CreateStackConfig creates a terramate.tm.hcl configuration file
func DefaultBinary ¶
func DefaultBinary() string
DefaultBinary resolves the Terramate binary used by regular execution. Missing release packaging resolves to an impossible path so host PATH cannot mask an incomplete StackKit package.
func PackagedBinaryPath ¶
PackagedBinaryPath returns the StackKit-packaged Terramate binary path. It intentionally does not fall back to PATH: advanced mode must prove the StackKit release package contains its own lifecycle toolchain.
Types ¶
type Change ¶
type Change struct {
ResourceType string `json:"resourceType"`
ResourceName string `json:"resourceName"`
Action string `json:"action"` // "create", "update", "delete", "no-op"
Details string `json:"details,omitempty"`
}
Change represents a detected change
type DriftResult ¶
type DriftResult struct {
HasDrift bool `json:"hasDrift"`
Stacks []StackDrift `json:"stacks"`
CheckedAt time.Time `json:"checkedAt"`
Duration time.Duration `json:"duration"`
}
DriftResult represents the result of drift detection
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor handles Terramate command execution
func NewExecutor ¶
func NewExecutor(opts ...ExecutorOption) *Executor
NewExecutor creates a new Terramate executor
func (*Executor) DetectDrift ¶
func (e *Executor) DetectDrift(ctx context.Context) (*DriftResult, error)
DetectDrift runs drift detection across all stacks
func (*Executor) IsInstalled ¶
IsInstalled checks if Terramate is installed
func (*Executor) ListChanged ¶
ListChanged lists stacks with changes (for change detection)
func (*Executor) RunDestroy ¶
RunDestroy runs tofu destroy on all stacks
type ExecutorOption ¶
type ExecutorOption func(*Executor)
ExecutorOption configures the Executor
func WithBinary ¶
func WithBinary(binary string) ExecutorOption
WithBinary sets the terramate binary path
func WithChangeDetection ¶
func WithChangeDetection(enabled bool) ExecutorOption
WithChangeDetection enables Git-based change detection
func WithParallelism ¶
func WithParallelism(p int) ExecutorOption
WithParallelism sets the parallelism level
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ExecutorOption
WithTimeout sets the execution timeout
func WithTofuBinary ¶
func WithTofuBinary(binary string) ExecutorOption
WithTofuBinary sets the OpenTofu binary for terramate run
func WithWorkDir ¶
func WithWorkDir(dir string) ExecutorOption
WithWorkDir sets the working directory
type Result ¶
type Result struct {
Success bool `json:"success"`
ExitCode int `json:"exitCode"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
Duration time.Duration `json:"duration"`
}
Result represents the result of a terramate command