sensitive

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: 6 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 sensitive is a choudoufu fork port (#2410, of #2256): sensitive values on OpenTofu's new runtime (internal/engine).

The new runtime's evaluator already marks what is sensitive: a `sensitive = true` variable or output, the sensitive() function, and everything derived from them carry marks.Sensitive through evaluation. What it does not do is carry those marks across the places where a value leaves evaluation, which the old runtime (internal/tofu) does:

  • planning hands the provider the configuration unmarked and records the planned change without its marks, so a sensitive argument plans, shows and reaches downstream references as plain text. Planned puts back the configuration's sensitive paths and the schema's sensitive attributes on the planned value, as node_resource_abstract_instance.go plan does, and Prior marks the prior object with the state's sensitive paths and the schema's, as its refresh does. Action turns a NoOp whose sensitivity changed into an Update, as the old runtime does, so the stored sensitive paths follow the configuration.
  • applying stored the provider's new object with no sensitive paths. That is fixed outside this port, unconditionally, by internal/engine/applying's storedSensitiveValue: a schema-sensitive attribute reached state and live-mode records unmarked even where this row never refused anything, so the fix cannot be switchable.
  • planning writes a root output's value into the plan's prior state still marked, which fails to serialize; OutputValue unmarks it and keeps its sensitivity as the state's flag.
  • a root output whose value is sensitive must be declared sensitive. UndeclaredRootOutput is that check, which the old runtime makes in node_output.go.

Only marks.Sensitive is handled. The engine's own marks (pending change, drift, resource instance) are never written by this port, and a state or record never receives one.

Upstream tracks the new runtime's mark gaps as opentofu/opentofu #4360. Every call site is commented "choudoufu fork port (#2410): remove when upstream #4360 lands". Removing the port is deleting this package, those call sites, the "sensitive" row's fork_port and switch in internal/live/newruntime/gaps.json, and the port tag on that row's detector in internal/live/newruntime/checks.go.

It is registered in internal/engine/forkport as Name. Switched off (forkport.Enabled), every function returns its input unchanged and the gap table's preflight refuses sensitive variables, outputs and the sensitive() function again, under its "sensitive" row.

Index

Constants

View Source
const Name = "sensitive"

Name is the port's name in the internal/engine/forkport registry.

Variables

This section is empty.

Functions

func Action

func Action(action plans.Action, before, after cty.Value) plans.Action

Action returns action, except that a NoOp whose planned value is sensitive at different paths than the prior object is an Update, so that applying it stores the new sensitive paths.

func Enabled

func Enabled() bool

Enabled reports whether the port is on.

func OutputValue

func OutputValue(v cty.Value) (cty.Value, bool)

OutputValue returns a root output value ready to store in a state: with no marks, and sensitive when any part of it was. With the port off it returns v as it is and false.

func Planned

func Planned(planned, config, prior cty.Value, ignore []cty.Path, schema *configschema.Block) cty.Value

Planned returns planned marked sensitive wherever config is, and wherever schema declares an attribute sensitive. config is the evaluated configuration value, with its marks; planned is the provider's planned object, which the engine planned from the unmarked configuration. Under an ignore_changes path the configuration was replaced by the prior object, so there prior's sensitive marks count instead of config's, as on the old runtime; prior is the marked prior object (Prior), null or cty.NilVal when there is none, and an empty path in ignore is ignore_changes = all.

func Prior

func Prior(prior cty.Value, statePaths []cty.Path, schema *configschema.Block) cty.Value

Prior returns prior, a prior object decoded from state without marks, marked sensitive at the state's sensitive paths and wherever schema declares an attribute sensitive.

func UndeclaredRootOutput

func UndeclaredRootOutput(root, declaredSensitive bool, v cty.Value, subject *hcl.Range) *hcl.Diagnostic

UndeclaredRootOutput is the old runtime's error for a root module output whose value is sensitive but that is not declared sensitive. It returns nil when the output is in a child module, is declared sensitive, or its value is not sensitive, and with the port off.

Types

This section is empty.

Jump to

Keyboard shortcuts

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