marks

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Ephemeral = valueMark("Ephemeral")

Ephemeral indicates that this value is marked as ephemeral in the context of OpenTofu.

View Source
const Sensitive = valueMark("Sensitive")

Sensitive indicates that this value is marked as sensitive in the context of OpenTofu.

View Source
const TypeType = valueMark("TypeType")

TypeType is used to indicate that the value contains a representation of another value's type. This is part of the implementation of the console-only `type` function.

Variables

This section is empty.

Functions

func Contains

func Contains(val cty.Value, mark valueMark) bool

Contains returns true if the cty.Value or any value within it contains the given mark.

func ContainsAnyMark

func ContainsAnyMark(val cty.Value, marks ...valueMark) bool

ContainsAnyMark returns true if the cty.Value or any value within it contains any of the given mark.

func Deprecated

func Deprecated(v cty.Value, cause DeprecationCause) cty.Value

Deprecated marks a given value as deprecated with specified DeprecationCause.

func DeprecatedDiagnosticOverride

func DeprecatedDiagnosticOverride(cause DeprecationCause) func() tfdiags.DiagnosticExtraWrapper

DeprecatedDiagnosticOverride is mainly created for unit testing. This is done this way just to avoid exporting deprecatedDiagnosticExtra from this package, which can create confusion when somebody would like to use this package.

func DeprecatedOutput

func DeprecatedOutput(v cty.Value, addr addrs.AbsOutputValue, msg string) cty.Value

DeprecatedOutput marks a given value as deprecated constructing a DeprecationCause from module output specific data.

func DeprecationMark

func DeprecationMark(cause DeprecationCause) any

func EnsureNoEphemeralMarks

func EnsureNoEphemeralMarks(pvms []cty.PathValueMarks) error

EnsureNoEphemeralMarks checks all the given paths for the Ephemeral mark. If there is at least one path marked as such, this method will return an error containing the marked paths.

func ExtractDeprecatedDiagnosticsWithExpr

func ExtractDeprecatedDiagnosticsWithExpr(val cty.Value, expr hcl.Expression) (cty.Value, tfdiags.Diagnostics)

ExtractDeprecatedDiagnosticsWithExpr composes deprecation diagnostics based on deprecation marks inside the cty.Value. It uses hcl.Expression to properly reference deprecated attributes in final diagnostics. The returned cty.Value has no deprecation marks inside, since all the relevant diagnostics has been collected.

func ExtractDeprecationDiagnosticsWithBody

func ExtractDeprecationDiagnosticsWithBody(val cty.Value, body hcl.Body) (cty.Value, tfdiags.Diagnostics)

ExtractDeprecationDiagnosticsWithBody composes deprecation diagnostics based on deprecation marks inside the cty.Value. It uses hcl.Body to properly reference deprecated attributes in final diagnostics. The returned cty.Value has no deprecation marks inside, since all the relevant diagnostics has been collected.

func Has

func Has(val cty.Value, mark valueMark) bool

Has returns true if and only if the cty.Value has the given mark.

func HasDeprecated

func HasDeprecated(v cty.Value) bool

HasDeprecated returns true if the cty.Value contains a deprecated mark.

func RemoveDeepDeprecated

func RemoveDeepDeprecated(val cty.Value) cty.Value

Types

type DeprecationCause

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

func DeprecationCauseOutput

func DeprecationCauseOutput(out addrs.AbsOutputValue, message string) DeprecationCause

func DeprecationCauseResource

func DeprecationCauseResource(res addrs.AbsResourceInstance, path cty.Path, message string) DeprecationCause

func DeprecationCauseVariable

func DeprecationCauseVariable(vaddr addrs.AbsInputVariableInstance, message string) DeprecationCause

func DiagnosticDeprecationCause

func DiagnosticDeprecationCause(diag tfdiags.Diagnostic) (DeprecationCause, bool)

DiagnosticDeprecationCause checks whether the given diagnostic is a deprecation warning, and if so returns the deprecation cause and true. If not, returns the zero value of DeprecationCause and false.

func (DeprecationCause) ExtraInfoKey

func (dc DeprecationCause) ExtraInfoKey() string

ExtraInfoKey returns the key used for consolidation of deprecation diagnostics. This will be enhanced by the view with module source address

func (DeprecationCause) ModuleInstance

func (dc DeprecationCause) ModuleInstance() addrs.ModuleInstance

Jump to

Keyboard shortcuts

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