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
- func DeferralRefusal(addr addrs.AbsResourceInstance) tfdiags.Diagnostics
- func FallbackWarning(rows []Row) tfdiags.Diagnostic
- func PostPlan(plan *plans.Plan, live bool) tfdiags.Diagnostics
- func Preflight(cfg *configs.Config, prior *states.State, live bool) tfdiags.Diagnostics
- func RefuseCommand(name string) tfdiags.Diagnostics
- func Strict() bool
- func UpstreamIssues() []string
- func WarningDetail() string
- type GapRefusal
- type Row
Constants ¶
const ( CheckLive = "live" CheckPreflight = "preflight" CheckPostPlan = "post_plan" CheckEngine = "engine" CheckAccepted = "accepted" CheckNone = "none" )
The check kinds a row can carry.
const ( ScopeLive = "live" ScopeNonLive = "non_live" ScopeAll = "all" )
The scopes a post-plan row can carry.
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.
const RefusalSummary = "Not supported on the new runtime yet"
RefusalSummary is the summary of every refusal this package raises. Tests match on it.
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.
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).
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 ¶
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.