newruntime

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MPL-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package newruntime holds choudoufu's gap table for OpenTofu's new runtime (#2256) and the refusals generated from it.

gaps.json is the only copy of the table: #2256 links to it. Each row names a gap between the new runtime (internal/engine) and what choudoufu needs, how it is handled while TOFU_X_EXPERIMENTAL_RUNTIME is on, and what closes it. The checks in this package read their rows from it, so a row's state changes in one place.

Index

Constants

View Source
const (
	CheckLive      = "live"
	CheckPreflight = "preflight"
	CheckPostPlan  = "post_plan"
	CheckEngine    = "engine"
	CheckAccepted  = "accepted"
	CheckNone      = "none"
)

The check kinds a row can carry.

View Source
const (
	ScopeLive    = "live"
	ScopeNonLive = "non_live"
	ScopeAll     = "all"
)

The scopes a post-plan row can carry.

View Source
const FallbackSummary = "Ran on the default runtime, not the new runtime"

FallbackSummary is the summary of the warning a run that fell back to the default runtime prints in place of WarningSummary. Tests match on it.

View Source
const RefusalSummary = "Not supported on the new runtime yet"

RefusalSummary is the summary of every refusal this package raises. Tests match on it.

View Source
const StrictVariable = "CHOUDOUFU_NEW_RUNTIME_STRICT"

StrictVariable keeps the gap table's refusals (#2397). With the toggle on and this unset, a run the new runtime cannot handle falls back to the default runtime for the whole run, with FallbackWarning. With it set, such a run is refused, as it was before #2397. The experimental-runtime lane sets it, so the expected-failures list keeps measuring the new runtime.

View Source
const Variable = "TOFU_X_EXPERIMENTAL_RUNTIME"

Variable is the opt-in that switches plan and apply onto the new runtime. It is upstream's own name (#2256 ruling 4).

View Source
const WarningSummary = "Running on OpenTofu's experimental new runtime"

WarningSummary is the summary of the warning every run that reaches the engine prints. Tests match on it.

Variables

This section is empty.

Functions

func DeferralRefusal

func DeferralRefusal(addr addrs.AbsResourceInstance) tfdiags.Diagnostics

DeferralRefusal is the engine row's diagnostic: the new runtime deferred an instance for a reason other than -target or -exclude. Plans have no record of deferral (a deferred instance simply has no planned change), so this is raised inside planning rather than by a post-plan check.

func FallbackWarning

func FallbackWarning(rows []Row) tfdiags.Diagnostic

FallbackWarning is the warning for a run that fell back to the default runtime because of rows: the variable, each row with what it waits for, and how to get the refusal instead.

func PostPlan

func PostPlan(plan *plans.Plan, live bool) tfdiags.Diagnostics

PostPlan refuses, before a plan is shown or saved, every change the table's post-plan rows name. live says whether the run is in live mode, which decides the scope of a row.

func Preflight

func Preflight(cfg *configs.Config, prior *states.State, live bool) tfdiags.Diagnostics

Preflight refuses, before planning, every construct the table's preflight rows name that the configuration or the prior state holds. It is run on plan with the toggle on, and on apply of a saved plan with the plan's configuration snapshot and prior state. live says whether the run is in live mode, which decides the scope of a row, as it does for PostPlan.

func RefuseCommand

func RefuseCommand(name string) tfdiags.Diagnostics

RefuseCommand refuses a command one of the table's preflight rows names, such as "test". The test harness still evaluates on the default runtime.

func Strict

func Strict() bool

Strict reports whether StrictVariable is set to any non-empty value. This is the only place it is read.

func UpstreamIssues

func UpstreamIssues() []string

UpstreamIssues returns every upstream issue and PR the table names, sorted, for scripts/upstream-sync.sh's report.

func WarningDetail

func WarningDetail() string

WarningDetail is the toggle's warning: the variable, and every accepted risk in the table.

Types

type GapRefusal

type GapRefusal interface {
	GapRowID() string
}

GapRefusal is the extra information every refusal from this package carries: the id of the gap row that raised it. RefusedRows reads it.

type Row

type Row struct {
	ID string `json:"id"`
	// Gap names what the new runtime cannot do yet.
	Gap string `json:"gap"`
	// Check is how the gap is handled under the toggle.
	Check string `json:"check"`
	// Construct names the detector a preflight, post-plan or engine row
	// uses. Every such row must name one this package implements.
	Construct string `json:"construct,omitempty"`
	// Scope, for a post-plan row, is "live" (live mode only), "non_live"
	// (outside live mode only) or "all". A preflight row may carry one too
	// (#2256 U10); a preflight row without one applies in both modes.
	Scope string `json:"scope,omitempty"`
	// Interim says what happens meanwhile.
	Interim string `json:"interim,omitempty"`
	// Warning is the text the toggle's warning carries for this row.
	Warning string `json:"warning,omitempty"`
	// ClosedBy says what closes the gap.
	ClosedBy string `json:"closed_by"`
	// Upstream lists opentofu/opentofu issues and PRs as "#NNNN".
	Upstream []string `json:"upstream"`
	// ForkPort, on a row choudoufu closes for now with its own code in
	// place of upstream's, names the fork-owned package that holds it.
	// Removing the port is deleting that package, its call sites (each
	// commented with the row's unit) and the row.
	ForkPort string `json:"fork_port,omitempty"`
	// Switch is the environment setting that turns a fork port off. With
	// it set, what the port covers is refused again by the row that
	// refused it before.
	Switch string `json:"switch,omitempty"`
}

Row is one gap.

func RefusedRows

func RefusedRows(diags tfdiags.Diagnostics) []Row

RefusedRows returns the rows behind every refusal in diags, each once, in table order. Diagnostics this package did not raise are ignored, so a caller can hand it everything a plan returned.

func RowByID

func RowByID(id string) (Row, bool)

RowByID returns the row with id, and whether there is one.

func Rows

func Rows() []Row

Rows returns the table, in file order.

func RowsFor

func RowsFor(check string) []Row

RowsFor returns the rows of one check kind, in file order.

func (Row) InScope

func (r Row) InScope(live bool) bool

InScope reports whether the row applies to a run, live saying whether the run is in live mode. A row with no scope applies to every run.

func (Row) WaitsFor

func (r Row) WaitsFor() string

WaitsFor is how a refusal names what it is waiting for.

Jump to

Keyboard shortcuts

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