Documentation
¶
Overview ¶
Package advanceddrift detects drift per Terramate stack of the local host (ADR-0045 section 2 and section 3, docs/ARCHITECTURE.md "Advanced drift per stack (Stage 1)").
Stack-level drift is what `tofu plan -detailed-exitcode` sees in each OpenTofu root. Container state that changes outside OpenTofu stays invisible to that plan; the native container drift detection of `stackkit drift detect` keeps covering it (ADR-0045 section 5), and the drift report combines both.
Index ¶
Constants ¶
const ( StackConverged = terramatehost.StackConverged StackDrifted = terramatehost.StackDrifted StackFailed = terramatehost.StackFailed StackPendingRoot = terramatehost.StackPendingRoot )
Per-stack statuses.
const ( StatusClean = "clean" StatusDrifted = "drifted" StatusUnknown = "unknown" )
Overall statuses of a drift report that carries stacks.
const EventPhase = "advanced.drift.stack"
EventPhase is the rollout event phase emitted once per stack, so Techstack can stream one drift subject per stack.
Variables ¶
This section is empty.
Functions ¶
func EventAttributes ¶
EventAttributes are the rollout event attributes of one stack entry.
func OverallStatus ¶
OverallStatus combines native drift and the stack entries: drifted when the native report or any stack drifted, otherwise unknown when any stack failed or a required root is pending, otherwise clean.
func ReconcileTargets ¶ added in v0.46.8
ReconcileTargets returns the stack IDs an Advanced drift reconcile forces to re-converge, in report (run) order: every drifted stack. Native drift that no stack plan attributes (a stopped container is not in OpenTofu state, so every stack plans clean) forces every core and workload stack whose root exists; `docker compose up` leaves running services unchanged.
Types ¶
type Request ¶
type Request struct {
WorkspaceRoot string
Layout terramatehost.Layout
Tools terramatehost.Tools
// ToolsErr reports that the packaged binaries are unavailable; every
// stack is then failed without any process run.
ToolsErr error
Timeout time.Duration
// Event receives every finished stack entry in run order.
Event func(Stack)
}
Request is one per-stack drift detection over the local host project.
type Stack ¶
type Stack struct {
StackID string `json:"stackId"`
Role string `json:"role"`
ModuleRef string `json:"moduleRef"`
SiteRef string `json:"siteRef"`
NodeRef string `json:"nodeRef"`
RuntimeRoot string `json:"runtimeRoot"`
Status string `json:"status"`
PlanExitCode *int `json:"planExitCode,omitempty"`
Summary *Summary `json:"summary,omitempty"`
DurationMS int64 `json:"durationMs"`
Detail string `json:"detail,omitempty"`
}
Stack is one `stacks[]` entry of `stackkit.drift-report/v1`.
type Summary ¶
type Summary struct {
Add int `json:"add"`
Change int `json:"change"`
Destroy int `json:"destroy"`
}
Summary is the resource count of a plan's `Plan: X to add, Y to change, Z to destroy.` line.
func ParseSummary ¶
ParseSummary reads the last `Plan: X to add, Y to change, Z to destroy` line of a plan output. `No changes.` yields a zero summary; any other output yields nil.