planmodifiers

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListEmptyIfOtherConfigured added in v1.0.11

func ListEmptyIfOtherConfigured(other path.Path, elementType attr.Type) planmodifier.List

ListEmptyIfOtherConfigured plans an empty list when the attribute is absent from configuration and a mutually exclusive attribute is configured.

It exists for Optional+Computed list attributes that pair with a conflicting attribute. Removing such a list from configuration does not plan a null: Terraform marks it unknown, the provider skips unknown values when building the request, and any server-side merge step is then free to restore the previous value. The net effect is that the removed value survives and both mutually exclusive settings end up applied.

Planning a known empty list instead makes the intent explicit: the request carries a non-nil empty slice, encoding/json omits it via omitempty, and a full-replacement API call clears the association.

An empty list is used rather than null deliberately. Refresh logic that normalises an absent server value to an empty list would disagree with a planned null, and Terraform would reject the apply with "Provider produced inconsistent result after apply".

Configuration is the only reliable signal here, so this reads req.Config rather than req.Plan; by the time the plan is built it may already carry the prior value that this modifier exists to discard.

func NullIfAlsoSetInt32

func NullIfAlsoSetInt32(onValues []string) planmodifier.Int32

func ObjectSuppressIfAttributeEquals

func ObjectSuppressIfAttributeEquals(attributePath path.Path, attributeValue attr.Value) planmodifier.Object

ObjectSuppressIfAttributeEquals returns a planmodifier.Object that suppresses the attribute if another attribute has a specific value.

func ObjectSuppressIfAttributeNotEquals

func ObjectSuppressIfAttributeNotEquals(attributePath path.Path, attributeValue attr.Value) planmodifier.Object

ObjectSuppressIfAttributeNotEquals returns a planmodifier.Object that suppresses the attribute if another attribute does NOT have a specific value.

func StringSuppressIfAttributeEquals

func StringSuppressIfAttributeEquals(attributePath path.Path, attributeValue attr.Value) planmodifier.String

StringSuppressIfAttributeEquals returns a planmodifier.String that suppresses the attribute if another attribute has a specific value.

func StringSuppressIfAttributeNotEquals

func StringSuppressIfAttributeNotEquals(attributePath path.Path, attributeValue attr.Value) planmodifier.String

StringSuppressIfAttributeNotEquals returns a planmodifier.String that suppresses the attribute if another attribute does NOT have a specific value.

func StringUseStateIfConfigUnchanged

func StringUseStateIfConfigUnchanged(paths []path.Path) planmodifier.String

StringUseStateIfConfigUnchanged returns a planmodifier.String that uses the state value if no configurable attributes have changed.

func ToEmptyStringIfNullOrUnknown

func ToEmptyStringIfNullOrUnknown() planmodifier.String

func ToLowercase

func ToLowercase() planmodifier.String

func ToNullStringIfUnknown

func ToNullStringIfUnknown() planmodifier.String

Types

This section is empty.

Jump to

Keyboard shortcuts

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