Help us shape the future of Go! Take the 2026 Go Developer Survey

opentofu

package
v0.55.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package opentofu is the standard StackKits runtime executor (ADR-0045): the standard execution path. It realizes one module's CUE-generated OpenTofu root with the packaged tofu binary and an offline provider mirror, keeps OpenTofu state in that root, and verifies the result with the native Verify semantics of the module. The native Compose executor in internal/runtimeexecutor/nativehost stays the fallback behind the compose target (S-F, ADR-0045 §6).

Index

Constants

View Source
const (
	CoolifyProviderModulesEnv = "STACKKIT_COOLIFY_PROVIDER_MODULES"
	CoolifyProviderImportEnv  = "STACKKIT_COOLIFY_PROVIDER_IMPORT_ID"
)
View Source
const (
	DokployProviderModulesEnv = "STACKKIT_DOKPLOY_PROVIDER_MODULES"
	DokployProviderImportEnv  = "STACKKIT_DOKPLOY_PROVIDER_IMPORT_ID"
	DokployProviderExecution  = "dokploy-provider"
)
View Source
const (
	KomodoProviderRecoverIDEnv   = "STACKKIT_KOMODO_PROVIDER_RECOVER_ID"
	KomodoProviderRecoverFromEnv = "STACKKIT_KOMODO_PROVIDER_RECOVER_FROM_ID"
)
View Source
const (
	KomodoProviderModulesEnv = "STACKKIT_KOMODO_PROVIDER_MODULES"
	KomodoProviderImportEnv  = "STACKKIT_KOMODO_PROVIDER_IMPORT_ID"
)
View Source
const (
	// UnitRef is the render unit, and runtime target unit, this executor owns.
	UnitRef = "opentofu"
	// TerramateUnitRef is the Core unit under the terramate target: the same
	// OpenTofu root plus its Terramate stack file.
	TerramateUnitRef = "terramate"
	// ArtifactKind and ArtifactFormat identify the executable root artifact.
	ArtifactKind   = "opentofu"
	ArtifactFormat = "hcl"
	ArtifactMode   = "0640"

	// RootDirName is the per-module root directory below the module's native
	// runtime directory: .stackkit/runtime/<runtimeDir>/opentofu.
	RootDirName = "opentofu"
	// ConfigFile, StateFile, LockFile, and ComposeFile are the root files the
	// executor-state checkpoint captures.
	ConfigFile  = "main.tf"
	StateFile   = "terraform.tfstate"
	LockFile    = ".terraform.lock.hcl"
	ComposeFile = "compose.yaml"
	// StackFile is the Terramate stack file placed beside main.tf.
	StackFile = "stack.tm.hcl"
	// EnvFile is the private interpolation file of a workload project; the
	// workload root references it and never embeds it.
	EnvFile = ".env"
	// PlanFile is the saved plan between plan and apply; it is removed after
	// apply because it embeds the full configuration.
	PlanFile = "tfplan"
	// CLIConfigFile is the generated offline CLI configuration.
	CLIConfigFile = "stackkit.tofurc"
	// MarkerFile binds a root directory to the module that owns it.
	MarkerFile = "stackkit-root.json"
	// ObservationFile holds the last apply observation; its digest is the
	// RuntimeOutcome observation digest.
	ObservationFile = "stackkit-apply-observation.json"

	// RootMarkerSchemaVersion versions the root marker document.
	RootMarkerSchemaVersion = "stackkit.opentofu-root/v1"
)
View Source
const (
	// RootKindWorkload is the executor-materialized root of one standalone
	// workload project: .stackkit/runtime/applications/<project>/opentofu.
	RootKindWorkload = "workload"
	// RootKindModule is the executor-materialized contract root of one edge
	// or federation owner: .stackkit/runtime/modules/<moduleRef>/opentofu.
	RootKindModule = "module"

	// RootExecutionNativeDocker marks a workload root whose containers are
	// native kreuzwerker/docker resources (ADR-0045 Stage 2 pilot).
	RootExecutionNativeDocker = "native-docker"

	// ApplicationsDir and ModulesDir are the runtime subtrees of the
	// executor-materialized roots (terramatestackgraph runtime roots).
	ApplicationsDir = "applications"
	ModulesDir      = "modules"
)

Root kinds. Core roots carry no kind in their marker (P1.1 layout).

View Source
const (

	// NativeModulesEnv is the explicit per-module opt-in of the ADR-0045
	// Stage 2 pilot: a comma-separated list of workload module refs whose
	// roots render native Docker-provider resources instead of the Stage 1
	// Compose wrapper. Unset, every root stays the wrapper. An entry without
	// a native renderer, or an opted-in module under the compose target,
	// fails closed; nothing falls back silently.
	NativeModulesEnv = "STACKKIT_OPENTOFU_NATIVE_MODULES"
)
View Source
const RootPreparationFile = "stackkit-root-preparation.json"

RootPreparationFile authenticates a closed file set while no executor marker exists. Ordinary Apply validates its exact deployment before handing that preparation to a current executor marker. The receipt then remains an origin record and keeps durability required on retries; it is no longer a live file allowlist. It contains digests only, never a second secret backup.

View Source
const RootPreparationRecovery = "checkpoint-restore"
View Source
const RootPreparationScaffold = "terramate-scaffold"
View Source
const RuntipiAPIExecution = "runtipi-api"
View Source
const RuntipiAPIModulesEnv = "STACKKIT_RUNTIPI_API_MODULES"
View Source
const SecretExecBinaryEnv = "STACKKIT_SECRET_EXEC_BINARY"

SecretExecBinaryEnv overrides the host path of the governed entrypoint shim binary (internal/secretexec).

Variables

This section is empty.

Functions

func AdmitGenericOperation added in v0.54.10

func AdmitGenericOperation(ctx context.Context, workspace string, roots []string) (context.Context, func() error, error)

AdmitGenericOperation acquires the complete current/destination batch at a public execution entry, or checks a nested call against its caller's lease. The returned release is a no-op for borrowed admission.

func AdmitSelectedGenericOperation added in v0.54.10

func AdmitSelectedGenericOperation(ctx context.Context, workspace string, roots []string) (context.Context, func() error, error)

AdmitSelectedGenericOperation admits a sealed operation's explicit ordinary destinations without discovering unrelated managers. A containing lease is still borrowed and rechecked in full. This does not select or recover owners.

func AlignRestoredWorkloadRoot added in v0.50.6

func AlignRestoredWorkloadRoot(workspaceRoot, runtimeRoot string) (returnErr error)

AlignRestoredWorkloadRoot completes the files a coordinated rollback restored into one workload root (state, main.tf, lock, compose.yaml, .env): the executor marker takes the execution of the restored configuration, so the next Apply leaves it through the right owner, and a native Docker-provider root gets its owner-only secret env files rendered from the restored .env, which its containers mount and its configuration digests. The restored main.tf must be exactly the native rendering of the restored Compose payload. A Core or contract root is left alone.

func DokployPlanAdmission added in v0.54.10

func DokployPlanAdmission(held platformdeploy.HostDeployment, payload []byte, description string) func(context.Context, *tofu.Executor, string) error

DokployPlanAdmission admits only in-place convergence of the independently held imported service. A missing remote object must never become a create, even if the provider removed it from refreshed state after API preflight.

func IsPlatformProviderExecution added in v0.54.10

func IsPlatformProviderExecution(execution string) bool

IsPlatformProviderExecution identifies platform-manager ownership that must survive generic capture, restore and transitions. The name stays compatible with existing callers; an API manager need not be an OpenTofu provider.

func KomodoDestroyPlanAdmission added in v0.54.10

func KomodoDestroyPlanAdmission(workspace, root string) func(context.Context, *tofu.Executor, string) error

KomodoDestroyPlanAdmission is the deletion boundary for the internal root workflow. It does not admit public remove. Only lifecycle coverage already present in untainted prior state can authorize deleting configuration; a planned create, imported stack alone, or a receipt alone is insufficient.

func KomodoPlanAdmission added in v0.54.10

func KomodoPlanAdmission(heldID, project, server, directory string) func(context.Context, *tofu.Executor, string) error

Inspect the saved plan after provider refresh, immediately before Apply. An independently held ID can converge in place, never create or replace.

func ModuleRootRelativePath

func ModuleRootRelativePath(moduleRef string) (string, error)

ModuleRootRelativePath is the contract root of one edge or federation owner module, the stack graph's runtimeRoot for it.

func RemoveBasementCoreWorkload added in v0.54.8

func RemoveBasementCoreWorkload(ctx context.Context, workspace string, request workloadremoval.Request) (workloadremoval.Result, error)

RemoveBasementCoreWorkload removes an applied Basement core whose Compose project the OpenTofu or Terramate root owns. It proves the exact applied root artifact, destroys that root offline under its Owner state custody (the root's destroy provisioner runs `docker compose down` and never removes volumes), and leaves the observation, data disposition and absence proof to the shared native Basement core removal owner.

func RenderContractRoot

func RenderContractRoot(target runtimeexecutor.RuntimeTarget, contract runtimeexecutor.Artifact) ([]byte, error)

RenderContractRoot renders the contract root of one owner: OpenTofu state records the digest of the contract artifact the owner applied, and a new contract replaces the record.

func RenderNativeWorkloadRoot added in v0.50.3

func RenderNativeWorkloadRoot(moduleRef string, prepared nativehost.NativeWorkloadCompose) (architecturev2renderer.NativeDockerRoot, error)

RenderNativeWorkloadRoot renders the ADR-0045 Stage 2 pilot root of one prepared workload project: native Docker-provider resources for exactly the containers of its Compose payload, secrets mounted from owner-only files beside it.

func RenderWorkloadRoot

func RenderWorkloadRoot(prepared nativehost.NativeWorkloadCompose) ([]byte, error)

RenderWorkloadRoot renders the wrapper root of one prepared workload project: the byte-identical Compose payload, the native project name, and a reference to the private .env (never its content).

func RequireGenericRestoreAdmission added in v0.54.10

func RequireGenericRestoreAdmission(workspaceRoot string, runtimeRoots []string) (returnErr error)

RequireGenericRestoreAdmission is a point check for nested writers whose entry point already holds AcquireGenericRestoreAdmission. It checks only the supplied destinations and never reacquires their project locks.

func RestoreCoreRoot

func RestoreCoreRoot(workspaceRoot, runtimeRoot string, config []byte) (_ []nativehost.RuntimeFileRestore, returnErr error)

RestoreCoreRoot restores the governed runtime files of one Core stack: the root's main.tf, which is the governed generation artifact, and the ../compose.yaml its local_file writes, the payload the artifact embeds.

func RestoreWorkloadRoot

func RestoreWorkloadRoot(ctx context.Context, workspaceRoot, runtimeRoot string, bundle []byte) (_ []nativehost.RuntimeFileRestore, returnErr error)

RestoreWorkloadRoot restores the governed runtime files of one workload stack from its workload bundle: the Compose project files the native preparation writes (compose.yaml, .env, configuration files) and the root's main.tf that RenderWorkloadRoot renders around that Compose file. runtimeRoot is the stack's root; the bundle must be the workload of that root, which the executor has already materialized.

func RootRelativePath

func RootRelativePath(runtimeDir string) (string, error)

RootRelativePath returns the slash-separated workspace-relative root of the module whose native runtime directory is runtimeDir.

func RunKomodoTofuOwner added in v0.54.10

func RunKomodoTofuOwner(ctx context.Context) (int, error)

RunKomodoTofuOwner is an authenticated, closed subprocess of the pinned executor. No CLI arguments, user-selected command, shell, or extra engine.

func RunKomodoWorkloadAction added in v0.54.10

func RunKomodoWorkloadAction(ctx context.Context, action, project, stackID string) error

RunKomodoWorkloadAction is the narrow subprocess entry point called only by the generated root. It loads credentials from existing node custody, checks the signed recipe and held ID, and never creates/updates stack config.

func RunRuntipiWorkloadAction added in v0.54.10

func RunRuntipiWorkloadAction(ctx context.Context, project, requestDigest string) error

RunRuntipiWorkloadAction runs inside the parent Apply's project lease. A per-invocation capability admits the helper to a duplicate of the same OS lock. The helper keeps that descriptor through API and observation, including parent process death. No credential is an argument.

func SecretExecBinary added in v0.50.6

func SecretExecBinary() string

SecretExecBinary is the host path a native root mounts as the governed entrypoint shim: SecretExecBinaryEnv, else the running stackkit binary, else a stackkit binary beside the running executable (stackkit-server). It is empty when none exists; a root that needs the shim then fails closed in the renderer.

func ValidateOrdinaryWorkloadCheckpoint added in v0.54.10

func ValidateOrdinaryWorkloadCheckpoint(moduleRef, project string, config, compose []byte) (string, error)

ValidateOrdinaryWorkloadCheckpoint requires a closed ordinary rendering of the captured Compose payload before a markerless root can acquire an executor. A platform provider configuration cannot acquire a generic wrapper identity.

func WithoutGenericRestoreAdmission added in v0.54.10

func WithoutGenericRestoreAdmission(ctx context.Context) context.Context

WithoutGenericRestoreAdmission keeps cancellation and lifecycle authority, but requires a governed child to acquire its normal executor admission.

func WorkloadRootRelativePath

func WorkloadRootRelativePath(project string) (string, error)

WorkloadRootRelativePath is the root of the standalone workload project stackkit-<workloadRef>-<nodeRef>, the stack graph's runtimeRoot for it.

func WriteGenericRootFiles added in v0.54.10

func WriteGenericRootFiles(tx *confinedfs.Transaction, view confinedfs.View, root, purpose, authority string, files map[string][]byte) (written []string, returnErr error)

WriteGenericRootFiles runs only under the destination project lock and an already verified plan/checkpoint. New roots are staged with signed ownership and published by a no-replace directory rename. Existing prepared roots get a signed old/new digest transition before their first write. These transitions require supported directory flushes; unsupported durability fails closed. Successful flushes support retry at file boundaries, without claiming hardware or filesystem crash guarantees beyond the operating system's durability API. Recovery never synthesizes a historical executor marker.

Types

type Authority

type Authority struct {
	ProviderContractHash string
	ModuleContractHash   string
	HealthContractHashes map[string]string
}

Authority is the factory-owned trust for one prepared target.

type ContractRootExecutor

type ContractRootExecutor struct {
	// contains filtered or unexported fields
}

ContractRootExecutor gives a native owner that has no Compose project (the Cloud public edge, the Modern federation link, and the bridge origin mTLS owner) a Terramate-visible OpenTofu root. Under the compose target it is the native executor, byte for byte. Under opentofu and terramate the native owner operation runs first, unchanged; after it succeeds the executor writes .stackkit/runtime/modules/<moduleRef>/opentofu/main.tf, a root with one terraform_data resource whose triggers_replace is the digest of the owner's contract artifact, and applies it, so OpenTofu state records the contract the owner applied. The root starts no process: StackKits has no safe CLI entrypoint that re-applies one owner from a local-exec.

func NewContractRootExecutor

func NewContractRootExecutor(native runtimeexecutor.Executor, runtime Runtime) *ContractRootExecutor

NewContractRootExecutor wraps one prepared native owner executor.

func (*ContractRootExecutor) Execute

Execute runs the native owner and, under an OpenTofu target, records its applied contract in the owner's contract root.

func (*ContractRootExecutor) Identity

Identity is the native owner's identity: the wrapper adds no authority.

type CoolifyWorkloadOperations added in v0.54.10

type CoolifyWorkloadOperations struct {
	// contains filtered or unexported fields
}

CoolifyWorkloadOperations retains the API owner except for explicitly imported Vault and Files workloads. Both configuration and activation use the pinned provider; the node's existing native observer remains authoritative.

func NewCoolifyWorkloadOperations added in v0.54.10

func NewCoolifyWorkloadOperations(runtime Runtime) (*CoolifyWorkloadOperations, error)

func (*CoolifyWorkloadOperations) ApplyWorkload added in v0.54.10

func (*CoolifyWorkloadOperations) ObserveWorkload added in v0.54.10

func (*CoolifyWorkloadOperations) ValidateWorkloadObservation added in v0.54.10

type DokployWorkloadOperations added in v0.54.10

type DokployWorkloadOperations struct {
	// contains filtered or unexported fields
}

func NewDokployWorkloadOperations added in v0.54.10

func NewDokployWorkloadOperations(runtime Runtime) (*DokployWorkloadOperations, error)

func (*DokployWorkloadOperations) AdoptWorkload added in v0.54.10

AdoptWorkload records an explicit exact service, never an inferred display name. Existing foreign roots/state cannot be reinterpreted as Dokploy.

func (*DokployWorkloadOperations) ApplyWorkload added in v0.54.10

func (*DokployWorkloadOperations) ObserveWorkload added in v0.54.10

func (*DokployWorkloadOperations) PrepareAdoptionRecipe added in v0.54.10

func (*DokployWorkloadOperations) ValidateWorkloadObservation added in v0.54.10

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor realizes exactly one module's OpenTofu root.

func NewExecutor

func NewExecutor(identity runtimeexecutor.ExecutorIdentity, binding nativehost.LocalTargetBinding, authority Authority, module ModuleBinding, runtime Runtime) *Executor

NewExecutor binds one prepared target scope to the host runtime.

func (*Executor) Execute

Execute writes the root, runs init, plan, and apply offline, and verifies the module. It never refreshes only, never replaces, and never destroys.

func (*Executor) Identity

type ExpectedStateRoot added in v0.47.7

type ExpectedStateRoot struct {
	Root        string
	ModuleRef   string
	InstanceRef string
}

ExpectedStateRoot is the signed Apply identity of one OpenTofu root that must exist during live verification. It is deliberately narrower than a filesystem discovery result: stale roots cannot add themselves to this set.

type GenericRestoreAdmission added in v0.54.10

type GenericRestoreAdmission struct {
	// contains filtered or unexported fields
}

GenericRestoreAdmission holds the destination project locks until generic recovery has finished its writes and engine calls. It is local to one operation and must be closed before invoking a governed recovery child.

func AcquireGenericRestoreAdmission added in v0.54.10

func AcquireGenericRestoreAdmission(workspaceRoot string, runtimeRoots []string) (_ *GenericRestoreAdmission, returnErr error)

AcquireGenericRestoreAdmission takes the same per-project OS locks as provider Apply/adopt before reading destination markers. The fixed set is the current runtime directories plus every explicit checkpoint destination, including absent roots. A new unrelated project is not a restore destination.

func (*GenericRestoreAdmission) AlignRestoredWorkloadRoot added in v0.54.10

func (a *GenericRestoreAdmission) AlignRestoredWorkloadRoot(runtimeRoot string) error

AlignRestoredWorkloadRoot keeps a coordinated rollback's batch lease through marker alignment and native secret preparation.

func (*GenericRestoreAdmission) CheckRoots added in v0.54.10

func (a *GenericRestoreAdmission) CheckRoots(workspace string, roots []string) error

CheckRoots validates reuse by a nested lifecycle reader/writer. Reuse is workspace-bound and cannot extend the already locked destination set.

func (*GenericRestoreAdmission) Close added in v0.54.10

func (a *GenericRestoreAdmission) Close() error

Close releases all project locks in reverse order, then their held workspace.

func (*GenericRestoreAdmission) Context added in v0.54.10

func (*GenericRestoreAdmission) RecreateOrdinaryRoots added in v0.54.10

func (a *GenericRestoreAdmission) RecreateOrdinaryRoots(ctx context.Context, checkpoint string, batch []OrdinaryRootRecreation) error

RecreateOrdinaryRoots retains the admission's exact held workspace handles. Every destination and publication domain passes before the first write.

func (*GenericRestoreAdmission) RestoreCoreRoot added in v0.54.10

func (a *GenericRestoreAdmission) RestoreCoreRoot(runtimeRoot string, config []byte) ([]nativehost.RuntimeFileRestore, error)

RestoreCoreRoot performs a nested repair without releasing the batch lease.

func (*GenericRestoreAdmission) RestoreRuntimeRootFiles added in v0.54.10

func (a *GenericRestoreAdmission) RestoreRuntimeRootFiles(ctx context.Context, roots []RuntimeRootRestore) ([]RestoredRootFile, error)

RestoreRuntimeRootFiles reuses a caller's admission when selection itself reads destination custody. It cannot add destinations to the held lease.

func (*GenericRestoreAdmission) RestoreWorkloadRoot added in v0.54.10

func (a *GenericRestoreAdmission) RestoreWorkloadRoot(ctx context.Context, runtimeRoot string, bundle []byte) ([]nativehost.RuntimeFileRestore, error)

RestoreWorkloadRoot performs a nested repair without relocking the project.

type KomodoActionLeases added in v0.54.10

type KomodoActionLeases struct {
	// contains filtered or unexported fields
}

KomodoActionLeases composes the shared single-recipient primitive for each bounded lifecycle action. All three borrow the SAME parent project flock; the service itself is shared with other executors and remains unmodified. The capability/socket values enter only process environment, never recipes, signed intent, configuration digests, state, argv or diagnostics.

func NewKomodoActionLeases added in v0.54.10

func NewKomodoActionLeases(lease *confinedfs.OutputLockLease, workspace, project string) (*KomodoActionLeases, error)

func (*KomodoActionLeases) Close added in v0.54.10

func (s *KomodoActionLeases) Close()

func (*KomodoActionLeases) Environment added in v0.54.10

func (s *KomodoActionLeases) Environment() []string

type KomodoWorkloadOperations added in v0.54.10

type KomodoWorkloadOperations struct {
	// contains filtered or unexported fields
}

KomodoWorkloadOperations switches explicitly selected Vault and imported Files workloads to provider configuration and the ordered API lifecycle bridge. Other workloads retain the existing adapter.

func NewKomodoWorkloadOperations added in v0.54.10

func NewKomodoWorkloadOperations(runtime Runtime) (*KomodoWorkloadOperations, error)

func (*KomodoWorkloadOperations) ApplyWorkload added in v0.54.10

func (*KomodoWorkloadOperations) ObserveWorkload added in v0.54.10

func (*KomodoWorkloadOperations) ValidateWorkloadObservation added in v0.54.10

type ModuleBinding

type ModuleBinding struct {
	ProviderRef    string
	ModuleRef      string
	WorkloadRef    string
	RuntimeDir     string
	ComposeProject string
}

ModuleBinding is one catalog module the OpenTofu executor may realize. The runtime directory and Compose project are the native executor's, so the OpenTofu root and the native fallback manage the same containers.

func DefaultModuleBindings

func DefaultModuleBindings() []ModuleBinding

DefaultModuleBindings is the closed list of modules whose OpenTofu unit is executable today. Every entry has a native Verify owner in nativehost.NativeComposeRuntime. P1.2 and P1.3 extend this list when they add OpenTofu units for further modules (workload bundles, Modern sites); a module without a native Verify owner needs one first.

func (ModuleBinding) Validate

func (b ModuleBinding) Validate() error

Validate rejects incomplete or non-portable bindings.

type OrdinaryRootRecreation added in v0.54.10

type OrdinaryRootRecreation struct {
	RuntimeRoot string
	Marker      RootMarker
	Files       map[string][]byte
}

OrdinaryRootRecreation is a verified checkpoint payload and the identity of its current ordinary executor. The receipt authenticates file preparation; the handoff marker identifies the executor that may now mutate those files.

type RestoredRootFile added in v0.54.10

type RestoredRootFile struct {
	RuntimeRoot string
	nativehost.RuntimeFileRestore
}

func RestoreRuntimeRootFiles added in v0.54.10

func RestoreRuntimeRootFiles(ctx context.Context, workspace string, roots []RuntimeRootRestore) (_ []RestoredRootFile, returnErr error)

RestoreRuntimeRootFiles admits the complete current/destination set before the first reconcile write, retaining all project leases through the batch.

type RootMarker

type RootMarker struct {
	SchemaVersion  string `json:"schemaVersion"`
	ModuleRef      string `json:"moduleRef"`
	InstanceRef    string `json:"instanceRef"`
	RuntimeDir     string `json:"runtimeDir"`
	ComposeProject string `json:"composeProject"`
	// Kind is empty for a Core root, else RootKindWorkload or RootKindModule.
	Kind string `json:"kind,omitempty"`
	// Execution is empty for the Stage 1 Compose wrapper, else
	// the native Docker or selected platform-manager execution.
	Execution string `json:"execution,omitempty"`
}

RootMarker is the secret-free identity of one materialized root.

func ReadRootMarker

func ReadRootMarker(rootDir string) (RootMarker, error)

ReadRootMarker reads and validates the marker of one root directory.

type Runtime

type Runtime struct {
	WorkspaceRoot string
	Native        nativehost.NativeComposeRuntime
	Binary        string
	ProvidersDir  string

	// Timeout bounds each tofu command; zero keeps the wrapper default.
	Timeout time.Duration
	// PlanAdmission is an owner-supplied restriction on the encrypted saved
	// plan, evaluated before any apply. Platform import/update-only paths use
	// it to refuse creation or replacement after a remote ID disappears.
	// It must discard provider output and return only secret-free diagnostics.
	PlanAdmission func(context.Context, *tofu.Executor, string) error
	// contains filtered or unexported fields
}

Runtime is the construction-owned host capability. Binary and ProvidersDir default to the packaged tofu and provider mirror; they are resolved at Execute so a missing package fails only an OpenTofu rollout, never a Compose one.

func (Runtime) DestroyKomodoWorkloadRoot added in v0.54.10

func (r Runtime) DestroyKomodoWorkloadRoot(ctx context.Context, project string) error

DestroyKomodoWorkloadRoot is the closed internal root operation. It is not a public remove/transition admission; callers still own that lifecycle policy. All internal runRootDestroy calls for a Komodo marker dispatch here too.

func (Runtime) InspectStates added in v0.47.7

func (r Runtime) InspectStates(ctx context.Context, expected []ExpectedStateRoot) ([]StateInspection, error)

InspectStates opens the exact roots named by the signed current Apply result with the same packaged binary, offline provider closure, and per-root Owner key used by Apply. It refuses missing or unconstrained current roots and never reports inactive historical roots left for rollback. Each address list is bound to the captured ciphertext bytes before returning.

type RuntimeRootRestore added in v0.54.10

type RuntimeRootRestore struct {
	RuntimeRoot    string
	CoreConfig     []byte
	WorkloadBundle []byte
}

RuntimeRootRestore is one governed generation's requested file repair. WorkloadBundle selects workload rendering; otherwise CoreConfig is used.

type RuntipiWorkloadOperations added in v0.54.10

type RuntipiWorkloadOperations struct {
	// contains filtered or unexported fields
}

RuntipiWorkloadOperations is an opt-in, existing-workload API bridge. The existing native owner performs mutation inside the OpenTofu action, not before it. Bootstrap, adoption, removal and provider lifecycle are excluded.

func NewRuntipiWorkloadOperations added in v0.54.10

func NewRuntipiWorkloadOperations(runtime Runtime) (*RuntipiWorkloadOperations, error)

func (*RuntipiWorkloadOperations) ApplyWorkload added in v0.54.10

func (*RuntipiWorkloadOperations) ObserveWorkload added in v0.54.10

type StateInspection added in v0.47.7

type StateInspection struct {
	Root        string   `json:"root"`
	StateSHA256 string   `json:"stateSha256"`
	Resources   []string `json:"resources"`
}

StateInspection is the secret-free result of opening one encrypted local backend through its Owner custody. Resources contains only closed resource addresses; no state values or OpenTofu diagnostics leave the executor.

type WorkloadOperations

type WorkloadOperations struct {
	// contains filtered or unexported fields
}

WorkloadOperations realizes the standalone workload bundles (the ten selected-PaaS applications) through their OpenTofu wrapper root when the request's generation target is opentofu or terramate, and through the native Compose owner otherwise (S-F fallback). Under an OpenTofu target the native preparation materializes the Compose project and its private .env exactly as today; the executor renders main.tf around that Compose file with RenderComposePayloadOpenTofu and runs init, plan, and apply in .stackkit/runtime/applications/<project>/opentofu instead of the native `docker compose up`; the native completion and observation run unchanged.

func NewWorkloadOperations

func NewWorkloadOperations(native nativehost.NativeWorkloadComposeOperations, runtime Runtime) (*WorkloadOperations, error)

NewWorkloadOperations wraps the native standalone Compose owner. The runtime's Native field is not used: workload verification is the native owner's ObserveWorkload.

func (*WorkloadOperations) ApplyWorkload

ApplyWorkload applies one workload bundle.

func (*WorkloadOperations) ObserveWorkload

ObserveWorkload is the native readback under every target.

func (*WorkloadOperations) ValidateWorkloadObservation

func (o *WorkloadOperations) ValidateWorkloadObservation(deployment nativehost.SelectedPaaSWorkloadDeployment, observation nativehost.SelectedPaaSWorkloadObservation) error

ValidateWorkloadObservation keeps the native semantic readback contract.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL