basetypes

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MPL-2.0 Imports: 12 Imported by: 118

Documentation

Overview

Package basetypes contains the implementations for framework-defined data types and values, such as boolean, floating point, integer, list, map, object, set, and string. Embed these implementations to create custom types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolTypable

type BoolTypable interface {
	attr.Type

	// ValueFromBool should convert the Bool to a BoolValuable type.
	ValueFromBool(context.Context, BoolValue) (BoolValuable, diag.Diagnostics)
}

BoolTypable extends attr.Type for bool types. Implement this interface to create a custom BoolType type.

type BoolType

type BoolType struct{}

BoolType is the base framework type for a boolean. BoolValue is the associated value type.

func (BoolType) ApplyTerraform5AttributePathStep

func (t BoolType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)

ApplyTerraform5AttributePathStep applies the given AttributePathStep to the type.

func (BoolType) Equal

func (t BoolType) Equal(o attr.Type) bool

Equal returns true if the given type is equivalent.

func (BoolType) String

func (t BoolType) String() string

String returns a human readable string of the type name.

func (BoolType) TerraformType

func (t BoolType) TerraformType(_ context.Context) tftypes.Type

TerraformType returns the tftypes.Type that should be used to represent this framework type.

func (BoolType) ValueFromBool

func (t BoolType) ValueFromBool(_ context.Context, v BoolValue) (BoolValuable, diag.Diagnostics)

ValueFromBool returns a BoolValuable type given a BoolValue.

func (BoolType) ValueFromTerraform

func (t BoolType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform returns a Value given a tftypes.Value. This is meant to convert the tftypes.Value into a more convenient Go type for the provider to consume the data with.

func (BoolType) ValueType

func (t BoolType) ValueType(_ context.Context) attr.Value

ValueType returns the Value type.

type BoolValuable

type BoolValuable interface {
	attr.Value

	// ToBoolValue should convert the value type to a Bool.
	ToBoolValue(ctx context.Context) (BoolValue, diag.Diagnostics)
}

BoolValuable extends attr.Value for boolean value types. Implement this interface to create a custom Bool value type.

type BoolValuableWithSemanticEquals added in v1.3.0

type BoolValuableWithSemanticEquals interface {
	BoolValuable

	// BoolSemanticEquals should return true if the given value is
	// semantically equal to the current value. This logic is used to prevent
	// Terraform data consistency errors and resource drift where a value change
	// may have inconsequential differences.
	//
	// Only known values are compared with this method as changing a value's
	// state implicitly represents a different value.
	BoolSemanticEquals(context.Context, BoolValuable) (bool, diag.Diagnostics)
}

BoolValuableWithSemanticEquals extends BoolValuable with semantic equality logic.

type BoolValue

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

BoolValue represents a boolean value.

func NewBoolNull

func NewBoolNull() BoolValue

NewBoolNull creates a Bool with a null value. Determine whether the value is null via the Bool type IsNull method.

func NewBoolPointerValue added in v1.2.0

func NewBoolPointerValue(value *bool) BoolValue

NewBoolPointerValue creates a Bool with a null value if nil or a known value. Access the value via the Bool type ValueBoolPointer method.

func NewBoolUnknown

func NewBoolUnknown() BoolValue

NewBoolUnknown creates a Bool with an unknown value. Determine whether the value is unknown via the Bool type IsUnknown method.

func NewBoolValue

func NewBoolValue(value bool) BoolValue

NewBoolValue creates a Bool with a known value. Access the value via the Bool type ValueBool method.

func (BoolValue) Equal

func (b BoolValue) Equal(other attr.Value) bool

Equal returns true if `other` is a *Bool and has the same value as `b`.

func (BoolValue) IsNull

func (b BoolValue) IsNull() bool

IsNull returns true if the Bool represents a null value.

func (BoolValue) IsUnknown

func (b BoolValue) IsUnknown() bool

IsUnknown returns true if the Bool represents a currently unknown value.

func (BoolValue) String

func (b BoolValue) String() string

String returns a human-readable representation of the Bool value. The string returned here is not protected by any compatibility guarantees, and is intended for logging and error reporting.

func (BoolValue) ToBoolValue

func (b BoolValue) ToBoolValue(context.Context) (BoolValue, diag.Diagnostics)

ToBoolValue returns Bool.

func (BoolValue) ToTerraformValue

func (b BoolValue) ToTerraformValue(_ context.Context) (tftypes.Value, error)

ToTerraformValue returns the data contained in the Bool as a tftypes.Value.

func (BoolValue) Type

func (b BoolValue) Type(_ context.Context) attr.Type

Type returns a BoolType.

func (BoolValue) ValueBool

func (b BoolValue) ValueBool() bool

ValueBool returns the known bool value. If Bool is null or unknown, returns false.

func (BoolValue) ValueBoolPointer added in v1.2.0

func (b BoolValue) ValueBoolPointer() *bool

ValueBoolPointer returns a pointer to the known bool value, nil for a null value, or a pointer to false for an unknown value.

type Float64Typable

type Float64Typable interface {
	xattr.TypeWithValidate

	// ValueFromFloat64 should convert the Float64 to a Float64Valuable type.
	ValueFromFloat64(context.Context, Float64Value) (Float64Valuable, diag.Diagnostics)
}

Float64Typable extends attr.Type for float64 types. Implement this interface to create a custom Float64Type type.

type Float64Type

type Float64Type struct{}

Float64Type is the base framework type for a floating point number. Float64Value is the associated value type.

func (Float64Type) ApplyTerraform5AttributePathStep

func (t Float64Type) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)

ApplyTerraform5AttributePathStep applies the given AttributePathStep to the type.

func (Float64Type) Equal

func (t Float64Type) Equal(o attr.Type) bool

Equal returns true if the given type is equivalent.

func (Float64Type) String

func (t Float64Type) String() string

String returns a human readable string of the type name.

func (Float64Type) TerraformType

func (t Float64Type) TerraformType(_ context.Context) tftypes.Type

TerraformType returns the tftypes.Type that should be used to represent this framework type.

func (Float64Type) Validate

func (t Float64Type) Validate(ctx context.Context, in tftypes.Value, path path.Path) diag.Diagnostics

Validate implements type validation.

func (Float64Type) ValueFromFloat64

ValueFromFloat64 returns a Float64Valuable type given a Float64Value.

func (Float64Type) ValueFromTerraform

func (t Float64Type) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform returns a Value given a tftypes.Value. This is meant to convert the tftypes.Value into a more convenient Go type for the provider to consume the data with.

func (Float64Type) ValueType

func (t Float64Type) ValueType(_ context.Context) attr.Value

ValueType returns the Value type.

type Float64Valuable

type Float64Valuable interface {
	attr.Value

	// ToFloat64Value should convert the value type to a Float64.
	ToFloat64Value(ctx context.Context) (Float64Value, diag.Diagnostics)
}

Float64Valuable extends attr.Value for float64 value types. Implement this interface to create a custom Float64 value type.

type Float64ValuableWithSemanticEquals added in v1.3.0

type Float64ValuableWithSemanticEquals interface {
	Float64Valuable

	// Float64SemanticEquals should return true if the given value is
	// semantically equal to the current value. This logic is used to prevent
	// Terraform data consistency errors and resource drift where a value change
	// may have inconsequential differences, such as rounding.
	//
	// Only known values are compared with this method as changing a value's
	// state implicitly represents a different value.
	Float64SemanticEquals(context.Context, Float64Valuable) (bool, diag.Diagnostics)
}

Float64ValuableWithSemanticEquals extends Float64Valuable with semantic equality logic.

type Float64Value

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

Float64Value represents a 64-bit floating point value, exposed as a float64.

func NewFloat64Null

func NewFloat64Null() Float64Value

Float64Null creates a Float64 with a null value. Determine whether the value is null via the Float64 type IsNull method.

func NewFloat64PointerValue added in v1.2.0

func NewFloat64PointerValue(value *float64) Float64Value

NewFloat64PointerValue creates a Float64 with a null value if nil or a known value. Access the value via the Float64 type ValueFloat64Pointer method.

func NewFloat64Unknown

func NewFloat64Unknown() Float64Value

Float64Unknown creates a Float64 with an unknown value. Determine whether the value is unknown via the Float64 type IsUnknown method.

Setting the deprecated Float64 type Null, Unknown, or Value fields after creating a Float64 with this function has no effect.

func NewFloat64Value

func NewFloat64Value(value float64) Float64Value

Float64Value creates a Float64 with a known value. Access the value via the Float64 type ValueFloat64 method.

Setting the deprecated Float64 type Null, Unknown, or Value fields after creating a Float64 with this function has no effect.

func (Float64Value) Equal

func (f Float64Value) Equal(other attr.Value) bool

Equal returns true if `other` is a Float64 and has the same value as `f`.

func (Float64Value) IsNull

func (f Float64Value) IsNull() bool

IsNull returns true if the Float64 represents a null value.

func (Float64Value) IsUnknown

func (f Float64Value) IsUnknown() bool

IsUnknown returns true if the Float64 represents a currently unknown value.

func (Float64Value) String

func (f Float64Value) String() string

String returns a human-readable representation of the Float64 value. The string returned here is not protected by any compatibility guarantees, and is intended for logging and error reporting.

func (Float64Value) ToFloat64Value

ToFloat64Value returns Float64.

func (Float64Value) ToTerraformValue

func (f Float64Value) ToTerraformValue(ctx context.Context) (tftypes.Value, error)

ToTerraformValue returns the data contained in the Float64 as a tftypes.Value.

func (Float64Value) Type

func (f Float64Value) Type(ctx context.Context) attr.Type

Type returns a Float64Type.

func (Float64Value) ValueFloat64

func (f Float64Value) ValueFloat64() float64

ValueFloat64 returns the known float64 value. If Float64 is null or unknown, returns 0.0.

func (Float64Value) ValueFloat64Pointer added in v1.2.0

func (f Float64Value) ValueFloat64Pointer() *float64

ValueFloat64Pointer returns a pointer to the known float64 value, nil for a null value, or a pointer to 0.0 for an unknown value.

type Int64Typable

type Int64Typable interface {
	xattr.TypeWithValidate

	// ValueFromInt64 should convert the Int64 to a Int64Valuable type.
	ValueFromInt64(context.Context, Int64Value) (Int64Valuable, diag.Diagnostics)
}

Int64Typable extends attr.Type for int64 types. Implement this interface to create a custom Int64Type type.

type Int64Type

type Int64Type struct{}

Int64Type is the base framework type for an integer number. Int64Value is the associated value type.

func (Int64Type) ApplyTerraform5AttributePathStep

func (t Int64Type) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)

ApplyTerraform5AttributePathStep applies the given AttributePathStep to the type.

func (Int64Type) Equal

func (t Int64Type) Equal(o attr.Type) bool

Equal returns true if the given type is equivalent.

func (Int64Type) String

func (t Int64Type) String() string

String returns a human readable string of the type name.

func (Int64Type) TerraformType

func (t Int64Type) TerraformType(_ context.Context) tftypes.Type

TerraformType returns the tftypes.Type that should be used to represent this framework type.

func (Int64Type) Validate

func (t Int64Type) Validate(ctx context.Context, in tftypes.Value, path path.Path) diag.Diagnostics

Validate implements type validation.

func (Int64Type) ValueFromInt64

func (t Int64Type) ValueFromInt64(_ context.Context, v Int64Value) (Int64Valuable, diag.Diagnostics)

ValueFromInt64 returns a Int64Valuable type given a Int64Value.

func (Int64Type) ValueFromTerraform

func (t Int64Type) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform returns a Value given a tftypes.Value. This is meant to convert the tftypes.Value into a more convenient Go type for the provider to consume the data with.

func (Int64Type) ValueType

func (t Int64Type) ValueType(_ context.Context) attr.Value

ValueType returns the Value type.

type Int64Valuable

type Int64Valuable interface {
	attr.Value

	// ToInt64Value should convert the value type to an Int64.
	ToInt64Value(ctx context.Context) (Int64Value, diag.Diagnostics)
}

Int64Valuable extends attr.Value for int64 value types. Implement this interface to create a custom Int64 value type.

type Int64ValuableWithSemanticEquals added in v1.3.0

type Int64ValuableWithSemanticEquals interface {
	Int64Valuable

	// Int64SemanticEquals should return true if the given value is
	// semantically equal to the current value. This logic is used to prevent
	// Terraform data consistency errors and resource drift where a value change
	// may have inconsequential differences, such as rounding.
	//
	// Only known values are compared with this method as changing a value's
	// state implicitly represents a different value.
	Int64SemanticEquals(context.Context, Int64Valuable) (bool, diag.Diagnostics)
}

Int64ValuableWithSemanticEquals extends Int64Valuable with semantic equality logic.

type Int64Value

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

Int64Value represents a 64-bit integer value, exposed as an int64.

func NewInt64Null

func NewInt64Null() Int64Value

NewInt64Null creates a Int64 with a null value. Determine whether the value is null via the Int64 type IsNull method.

func NewInt64PointerValue added in v1.2.0

func NewInt64PointerValue(value *int64) Int64Value

NewInt64PointerValue creates a Int64 with a null value if nil or a known value. Access the value via the Int64 type ValueInt64Pointer method.

func NewInt64Unknown

func NewInt64Unknown() Int64Value

NewInt64Unknown creates a Int64 with an unknown value. Determine whether the value is unknown via the Int64 type IsUnknown method.

func NewInt64Value

func NewInt64Value(value int64) Int64Value

NewInt64Value creates a Int64 with a known value. Access the value via the Int64 type ValueInt64 method.

func (Int64Value) Equal

func (i Int64Value) Equal(other attr.Value) bool

Equal returns true if `other` is an Int64 and has the same value as `i`.

func (Int64Value) IsNull

func (i Int64Value) IsNull() bool

IsNull returns true if the Int64 represents a null value.

func (Int64Value) IsUnknown

func (i Int64Value) IsUnknown() bool

IsUnknown returns true if the Int64 represents a currently unknown value.

func (Int64Value) String

func (i Int64Value) String() string

String returns a human-readable representation of the Int64 value. The string returned here is not protected by any compatibility guarantees, and is intended for logging and error reporting.

func (Int64Value) ToInt64Value

func (i Int64Value) ToInt64Value(context.Context) (Int64Value, diag.Diagnostics)

ToInt64Value returns Int64.

func (Int64Value) ToTerraformValue

func (i Int64Value) ToTerraformValue(ctx context.Context) (tftypes.Value, error)

ToTerraformValue returns the data contained in the Int64 as a tftypes.Value.

func (Int64Value) Type

func (i Int64Value) Type(ctx context.Context) attr.Type

Type returns a Int64Type.

func (Int64Value) ValueInt64

func (i Int64Value) ValueInt64() int64

ValueInt64 returns the known int64 value. If Int64 is null or unknown, returns 0.

func (Int64Value) ValueInt64Pointer added in v1.2.0

func (i Int64Value) ValueInt64Pointer() *int64

ValueInt64Pointer returns a pointer to the known int64 value, nil for a null value, or a pointer to 0 for an unknown value.

type ListTypable

type ListTypable interface {
	attr.Type

	// ValueFromList should convert the List to a ListValuable type.
	ValueFromList(context.Context, ListValue) (ListValuable, diag.Diagnostics)
}

ListTypable extends attr.Type for list types. Implement this interface to create a custom ListType type.

type ListType

type ListType struct {
	ElemType attr.Type
}

ListType is an AttributeType representing a list of values. All values must be of the same type, which the provider must specify as the ElemType property.

func (ListType) ApplyTerraform5AttributePathStep

func (l ListType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)

ApplyTerraform5AttributePathStep applies the given AttributePathStep to the list.

func (ListType) ElementType

func (l ListType) ElementType() attr.Type

ElementType returns the attr.Type elements will be created from.

func (ListType) Equal

func (l ListType) Equal(o attr.Type) bool

Equal returns true if `o` is also a ListType and has the same ElemType.

func (ListType) String

func (l ListType) String() string

String returns a human-friendly description of the ListType.

func (ListType) TerraformType

func (l ListType) TerraformType(ctx context.Context) tftypes.Type

TerraformType returns the tftypes.Type that should be used to represent this type. This constrains what user input will be accepted and what kind of data can be set in state. The framework will use this to translate the AttributeType to something Terraform can understand.

func (ListType) Validate

func (l ListType) Validate(ctx context.Context, in tftypes.Value, path path.Path) diag.Diagnostics

Validate validates all elements of the list that are of type xattr.TypeWithValidate.

func (ListType) ValueFromList

func (l ListType) ValueFromList(_ context.Context, list ListValue) (ListValuable, diag.Diagnostics)

ValueFromList returns a ListValuable type given a List.

func (ListType) ValueFromTerraform

func (l ListType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform returns an attr.Value given a tftypes.Value. This is meant to convert the tftypes.Value into a more convenient Go type for the provider to consume the data with.

func (ListType) ValueType

func (l ListType) ValueType(_ context.Context) attr.Value

ValueType returns the Value type.

func (ListType) WithElementType

func (l ListType) WithElementType(typ attr.Type) attr.TypeWithElementType

WithElementType returns a ListType that is identical to `l`, but with the element type set to `typ`.

type ListValuable

type ListValuable interface {
	attr.Value

	// ToListValue should convert the value type to a List.
	ToListValue(ctx context.Context) (ListValue, diag.Diagnostics)
}

ListValuable extends attr.Value for list value types. Implement this interface to create a custom List value type.

type ListValuableWithSemanticEquals added in v1.3.0

type ListValuableWithSemanticEquals interface {
	ListValuable

	// ListSemanticEquals should return true if the given value is
	// semantically equal to the current value. This logic is used to prevent
	// Terraform data consistency errors and resource drift where a value change
	// may have inconsequential differences, such as computed elements added by
	// a remote system.
	//
	// Only known values are compared with this method as changing a value's
	// state implicitly represents a different value.
	ListSemanticEquals(context.Context, ListValuable) (bool, diag.Diagnostics)
}

ListValuableWithSemanticEquals extends ListValuable with semantic equality logic.

type ListValue

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

ListValue represents a list of attr.Values, all of the same type, indicated by ElemType.

func NewListNull

func NewListNull(elementType attr.Type) ListValue

NewListNull creates a List with a null value. Determine whether the value is null via the List type IsNull method.

func NewListUnknown

func NewListUnknown(elementType attr.Type) ListValue

NewListUnknown creates a List with an unknown value. Determine whether the value is unknown via the List type IsUnknown method.

func NewListValue

func NewListValue(elementType attr.Type, elements []attr.Value) (ListValue, diag.Diagnostics)

NewListValue creates a List with a known value. Access the value via the List type Elements or ElementsAs methods.

func NewListValueFrom

func NewListValueFrom(ctx context.Context, elementType attr.Type, elements any) (ListValue, diag.Diagnostics)

NewListValueFrom creates a List with a known value, using reflection rules. The elements must be a slice which can convert into the given element type. Access the value via the List type Elements or ElementsAs methods.

func NewListValueMust

func NewListValueMust(elementType attr.Type, elements []attr.Value) ListValue

NewListValueMust creates a List with a known value, converting any diagnostics into a panic at runtime. Access the value via the List type Elements or ElementsAs methods.

This creation function is only recommended to create List values which will not potentially affect practitioners, such as testing, or exhaustively tested provider logic.

func (ListValue) ElementType

func (l ListValue) ElementType(_ context.Context) attr.Type

ElementType returns the element type for the List.

func (ListValue) Elements

func (l ListValue) Elements() []attr.Value

Elements returns a copy of the collection of elements for the List.

func (ListValue) ElementsAs

func (l ListValue) ElementsAs(ctx context.Context, target interface{}, allowUnhandled bool) diag.Diagnostics

ElementsAs populates `target` with the elements of the ListValue, throwing an error if the elements cannot be stored in `target`.

func (ListValue) Equal

func (l ListValue) Equal(o attr.Value) bool

Equal returns true if the given attr.Value is also a ListValue, has the same element type, same value state, and contains exactly the element values as defined by the Equal method of the element type.

func (ListValue) IsNull

func (l ListValue) IsNull() bool

IsNull returns true if the List represents a null value.

func (ListValue) IsUnknown

func (l ListValue) IsUnknown() bool

IsUnknown returns true if the List represents a currently unknown value. Returns false if the List has a known number of elements, even if all are unknown values.

func (ListValue) String

func (l ListValue) String() string

String returns a human-readable representation of the List value. The string returned here is not protected by any compatibility guarantees, and is intended for logging and error reporting.

func (ListValue) ToListValue

func (l ListValue) ToListValue(context.Context) (ListValue, diag.Diagnostics)

ToListValue returns the List.

func (ListValue) ToTerraformValue

func (l ListValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error)

ToTerraformValue returns the data contained in the List as a tftypes.Value.

func (ListValue) Type

func (l ListValue) Type(ctx context.Context) attr.Type

Type returns a ListType with the same element type as `l`.

type MapTypable

type MapTypable interface {
	attr.Type

	// ValueFromMap should convert the Map to a MapValuable type.
	ValueFromMap(context.Context, MapValue) (MapValuable, diag.Diagnostics)
}

MapTypable extends attr.Type for map types. Implement this interface to create a custom MapType type.

type MapType

type MapType struct {
	ElemType attr.Type
}

MapType is an AttributeType representing a map of values. All values must be of the same type, which the provider must specify as the ElemType property. Keys will always be strings.

func (MapType) ApplyTerraform5AttributePathStep

func (m MapType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)

ApplyTerraform5AttributePathStep applies the given AttributePathStep to the map.

func (MapType) ElementType

func (m MapType) ElementType() attr.Type

ElementType returns the type's element type.

func (MapType) Equal

func (m MapType) Equal(o attr.Type) bool

Equal returns true if `o` is also a MapType and has the same ElemType.

func (MapType) String

func (m MapType) String() string

String returns a human-friendly description of the MapType.

func (MapType) TerraformType

func (m MapType) TerraformType(ctx context.Context) tftypes.Type

TerraformType returns the tftypes.Type that should be used to represent this type. This constrains what user input will be accepted and what kind of data can be set in state. The framework will use this to translate the AttributeType to something Terraform can understand.

func (MapType) Validate

func (m MapType) Validate(ctx context.Context, in tftypes.Value, path path.Path) diag.Diagnostics

Validate validates all elements of the map that are of type xattr.TypeWithValidate.

func (MapType) ValueFromMap

func (m MapType) ValueFromMap(_ context.Context, ma MapValue) (MapValuable, diag.Diagnostics)

ValueFromMap returns a MapValuable type given a Map.

func (MapType) ValueFromTerraform

func (m MapType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform returns an attr.Value given a tftypes.Value. This is meant to convert the tftypes.Value into a more convenient Go type for the provider to consume the data with.

func (MapType) ValueType

func (m MapType) ValueType(_ context.Context) attr.Value

ValueType returns the Value type.

func (MapType) WithElementType

func (m MapType) WithElementType(typ attr.Type) attr.TypeWithElementType

WithElementType returns a new copy of the type with its element type set.

type MapValuable

type MapValuable interface {
	attr.Value

	// ToMapValue should convert the value type to a Map.
	ToMapValue(ctx context.Context) (MapValue, diag.Diagnostics)
}

MapValuable extends attr.Value for map value types. Implement this interface to create a custom Map value type.

type MapValuableWithSemanticEquals added in v1.3.0

type MapValuableWithSemanticEquals interface {
	MapValuable

	// MapSemanticEquals should return true if the given value is
	// semantically equal to the current value. This logic is used to prevent
	// Terraform data consistency errors and resource drift where a value change
	// may have inconsequential differences, such as computed elements added by
	// a remote system.
	//
	// Only known values are compared with this method as changing a value's
	// state implicitly represents a different value.
	MapSemanticEquals(context.Context, MapValuable) (bool, diag.Diagnostics)
}

MapValuableWithSemanticEquals extends MapValuable with semantic equality logic.

type MapValue

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

MapValue represents a mapping of string keys to attr.Value values of a single type.

func NewMapNull

func NewMapNull(elementType attr.Type) MapValue

NewMapNull creates a Map with a null value. Determine whether the value is null via the Map type IsNull method.

func NewMapUnknown

func NewMapUnknown(elementType attr.Type) MapValue

NewMapUnknown creates a Map with an unknown value. Determine whether the value is unknown via the Map type IsUnknown method.

func NewMapValue

func NewMapValue(elementType attr.Type, elements map[string]attr.Value) (MapValue, diag.Diagnostics)

NewMapValue creates a Map with a known value. Access the value via the Map type Elements or ElementsAs methods.

func NewMapValueFrom

func NewMapValueFrom(ctx context.Context, elementType attr.Type, elements any) (MapValue, diag.Diagnostics)

NewMapValueFrom creates a Map with a known value, using reflection rules. The elements must be a map of string keys to values which can convert into the given element type. Access the value via the Map type Elements or ElementsAs methods.

func NewMapValueMust

func NewMapValueMust(elementType attr.Type, elements map[string]attr.Value) MapValue

NewMapValueMust creates a Map with a known value, converting any diagnostics into a panic at runtime. Access the value via the Map type Elements or ElementsAs methods.

This creation function is only recommended to create Map values which will not potentially effect practitioners, such as testing, or exhaustively tested provider logic.

func (MapValue) ElementType

func (m MapValue) ElementType(_ context.Context) attr.Type

ElementType returns the element type for the Map.

func (MapValue) Elements

func (m MapValue) Elements() map[string]attr.Value

Elements returns a copy of the mapping of elements for the Map.

func (MapValue) ElementsAs

func (m MapValue) ElementsAs(ctx context.Context, target interface{}, allowUnhandled bool) diag.Diagnostics

ElementsAs populates `target` with the elements of the MapValue, throwing an error if the elements cannot be stored in `target`.

func (MapValue) Equal

func (m MapValue) Equal(o attr.Value) bool

Equal returns true if the given attr.Value is also a MapValue, has the same element type, same value state, and contains exactly the element values as defined by the Equal method of the element type.

func (MapValue) IsNull

func (m MapValue) IsNull() bool

IsNull returns true if the Map represents a null value.

func (MapValue) IsUnknown

func (m MapValue) IsUnknown() bool

IsUnknown returns true if the Map represents a currently unknown value. Returns false if the Map has a known number of elements, even if all are unknown values.

func (MapValue) String

func (m MapValue) String() string

String returns a human-readable representation of the Map value. The string returned here is not protected by any compatibility guarantees, and is intended for logging and error reporting.

func (MapValue) ToMapValue

func (m MapValue) ToMapValue(context.Context) (MapValue, diag.Diagnostics)

ToMapValue returns the Map.

func (MapValue) ToTerraformValue

func (m MapValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error)

ToTerraformValue returns the data contained in the Map as a tftypes.Value.

func (MapValue) Type

func (m MapValue) Type(ctx context.Context) attr.Type

Type returns a MapType with the same element type as `m`.

type NumberTypable

type NumberTypable interface {
	attr.Type

	// ValueFromNumber should convert the Number to a NumberValuable type.
	ValueFromNumber(context.Context, NumberValue) (NumberValuable, diag.Diagnostics)
}

NumberTypable extends attr.Type for number types. Implement this interface to create a custom NumberType type.

type NumberType

type NumberType struct{}

NumberType is the base framework type for a floating point number. NumberValue is the associated value type.

func (NumberType) ApplyTerraform5AttributePathStep

func (t NumberType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)

ApplyTerraform5AttributePathStep applies the given AttributePathStep to the type.

func (NumberType) Equal

func (t NumberType) Equal(o attr.Type) bool

Equal returns true if the given type is equivalent.

func (NumberType) String

func (t NumberType) String() string

String returns a human readable string of the type name.

func (NumberType) TerraformType

func (t NumberType) TerraformType(_ context.Context) tftypes.Type

TerraformType returns the tftypes.Type that should be used to represent this framework type.

func (NumberType) ValueFromNumber

ValueFromNumber returns a NumberValuable type given a NumberValue.

func (NumberType) ValueFromTerraform

func (t NumberType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform returns a Value given a tftypes.Value. This is meant to convert the tftypes.Value into a more convenient Go type for the provider to consume the data with.

func (NumberType) ValueType

func (t NumberType) ValueType(_ context.Context) attr.Value

ValueType returns the Value type.

type NumberValuable

type NumberValuable interface {
	attr.Value

	// ToNumberValue should convert the value type to a Number.
	ToNumberValue(ctx context.Context) (NumberValue, diag.Diagnostics)
}

NumberValuable extends attr.Value for number value types. Implement this interface to create a custom Number value type.

type NumberValuableWithSemanticEquals added in v1.3.0

type NumberValuableWithSemanticEquals interface {
	NumberValuable

	// NumberSemanticEquals should return true if the given value is
	// semantically equal to the current value. This logic is used to prevent
	// Terraform data consistency errors and resource drift where a value change
	// may have inconsequential differences, such as rounding.
	//
	// Only known values are compared with this method as changing a value's
	// state implicitly represents a different value.
	NumberSemanticEquals(context.Context, NumberValuable) (bool, diag.Diagnostics)
}

NumberValuableWithSemanticEquals extends NumberValuable with semantic equality logic.

type NumberValue

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

NumberValue represents a number value, exposed as a *big.Float. Numbers can be floats or integers.

func NewNumberNull

func NewNumberNull() NumberValue

NewNumberNull creates a Number with a null value. Determine whether the value is null via the Number type IsNull method.

func NewNumberUnknown

func NewNumberUnknown() NumberValue

NewNumberUnknown creates a Number with an unknown value. Determine whether the value is unknown via the Number type IsUnknown method.

func NewNumberValue

func NewNumberValue(value *big.Float) NumberValue

NewNumberValue creates a Number with a known value. Access the value via the Number type ValueBigFloat method. If the given value is nil, a null Number is created.

func (NumberValue) Equal

func (n NumberValue) Equal(other attr.Value) bool

Equal returns true if `other` is a Number and has the same value as `n`.

func (NumberValue) IsNull

func (n NumberValue) IsNull() bool

IsNull returns true if the Number represents a null value.

func (NumberValue) IsUnknown

func (n NumberValue) IsUnknown() bool

IsUnknown returns true if the Number represents a currently unknown value.

func (NumberValue) String

func (n NumberValue) String() string

String returns a human-readable representation of the Number value. The string returned here is not protected by any compatibility guarantees, and is intended for logging and error reporting.

func (NumberValue) ToNumberValue

func (n NumberValue) ToNumberValue(context.Context) (NumberValue, diag.Diagnostics)

ToNumberValue returns Number.

func (NumberValue) ToTerraformValue

func (n NumberValue) ToTerraformValue(_ context.Context) (tftypes.Value, error)

ToTerraformValue returns the data contained in the Number as a tftypes.Value.

func (NumberValue) Type

func (n NumberValue) Type(_ context.Context) attr.Type

Type returns a NumberType.

func (NumberValue) ValueBigFloat

func (n NumberValue) ValueBigFloat() *big.Float

ValueBigFloat returns the known *big.Float value. If Number is null or unknown, returns 0.0.

type ObjectAsOptions

type ObjectAsOptions struct {
	// UnhandledNullAsEmpty controls what happens when As needs to put a
	// null value in a type that has no way to preserve that distinction.
	// When set to true, the type's empty value will be used.  When set to
	// false, an error will be returned.
	UnhandledNullAsEmpty bool

	// UnhandledUnknownAsEmpty controls what happens when As needs to put
	// an unknown value in a type that has no way to preserve that
	// distinction. When set to true, the type's empty value will be used.
	// When set to false, an error will be returned.
	UnhandledUnknownAsEmpty bool
}

ObjectAsOptions is a collection of toggles to control the behavior of Object.As.

type ObjectTypable

type ObjectTypable interface {
	attr.Type

	// ValueFromObject should convert the Object to an ObjectValuable type.
	ValueFromObject(context.Context, ObjectValue) (ObjectValuable, diag.Diagnostics)
}

ObjectTypable extends attr.Type for object types. Implement this interface to create a custom ObjectType type.

type ObjectType

type ObjectType struct {
	AttrTypes map[string]attr.Type
}

ObjectType is an AttributeType representing an object.

func (ObjectType) ApplyTerraform5AttributePathStep

func (o ObjectType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)

ApplyTerraform5AttributePathStep applies the given AttributePathStep to the object.

func (ObjectType) AttributeTypes

func (o ObjectType) AttributeTypes() map[string]attr.Type

AttributeTypes returns a copy of the type's attribute types.

func (ObjectType) Equal

func (o ObjectType) Equal(candidate attr.Type) bool

Equal returns true if `candidate` is also an ObjectType and has the same AttributeTypes.

func (ObjectType) String

func (o ObjectType) String() string

String returns a human-friendly description of the ObjectType.

func (ObjectType) TerraformType

func (o ObjectType) TerraformType(ctx context.Context) tftypes.Type

TerraformType returns the tftypes.Type that should be used to represent this type. This constrains what user input will be accepted and what kind of data can be set in state. The framework will use this to translate the AttributeType to something Terraform can understand.

func (ObjectType) ValueFromObject

func (o ObjectType) ValueFromObject(_ context.Context, obj ObjectValue) (ObjectValuable, diag.Diagnostics)

ValueFromObject returns an ObjectValuable type given an Object.

func (ObjectType) ValueFromTerraform

func (o ObjectType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform returns an attr.Value given a tftypes.Value. This is meant to convert the tftypes.Value into a more convenient Go type for the provider to consume the data with.

func (ObjectType) ValueType

func (o ObjectType) ValueType(_ context.Context) attr.Value

ValueType returns the Value type.

func (ObjectType) WithAttributeTypes

func (o ObjectType) WithAttributeTypes(typs map[string]attr.Type) attr.TypeWithAttributeTypes

WithAttributeTypes returns a new copy of the type with its attribute types set.

type ObjectValuable

type ObjectValuable interface {
	attr.Value

	// ToObjectValue should convert the value type to an Object.
	ToObjectValue(ctx context.Context) (ObjectValue, diag.Diagnostics)
}

ObjectValuable extends attr.Value for object value types. Implement this interface to create a custom Object value type.

type ObjectValuableWithSemanticEquals added in v1.3.0

type ObjectValuableWithSemanticEquals interface {
	ObjectValuable

	// ObjectSemanticEquals should return true if the given value is
	// semantically equal to the current value. This logic is used to prevent
	// Terraform data consistency errors and resource drift where a value change
	// may have inconsequential differences, such as computed attribute values
	// changed by a remote system.
	//
	// Only known values are compared with this method as changing a value's
	// state implicitly represents a different value.
	ObjectSemanticEquals(context.Context, ObjectValuable) (bool, diag.Diagnostics)
}

ObjectValuableWithSemanticEquals extends ObjectValuable with semantic equality logic.

type ObjectValue

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

ObjectValue represents an object

func NewObjectNull

func NewObjectNull(attributeTypes map[string]attr.Type) ObjectValue

NewObjectNull creates a Object with a null value. Determine whether the value is null via the Object type IsNull method.

func NewObjectUnknown

func NewObjectUnknown(attributeTypes map[string]attr.Type) ObjectValue

NewObjectUnknown creates a Object with an unknown value. Determine whether the value is unknown via the Object type IsUnknown method.

func NewObjectValue

func NewObjectValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (ObjectValue, diag.Diagnostics)

NewObjectValue creates a Object with a known value. Access the value via the Object type ElementsAs method.

func NewObjectValueFrom

func NewObjectValueFrom(ctx context.Context, attributeTypes map[string]attr.Type, attributes any) (ObjectValue, diag.Diagnostics)

NewObjectValueFrom creates a Object with a known value, using reflection rules. The attributes must be a map of string attribute names to attribute values which can convert into the given attribute type or a struct with tfsdk field tags. Access the value via the Object type Elements or ElementsAs methods.

func NewObjectValueMust

func NewObjectValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) ObjectValue

NewObjectValueMust creates a Object with a known value, converting any diagnostics into a panic at runtime. Access the value via the Object type Elements or ElementsAs methods.

This creation function is only recommended to create Object values which will not potentially effect practitioners, such as testing, or exhaustively tested provider logic.

func (ObjectValue) As

func (o ObjectValue) As(ctx context.Context, target interface{}, opts ObjectAsOptions) diag.Diagnostics

As populates `target` with the data in the ObjectValue, throwing an error if the data cannot be stored in `target`.

func (ObjectValue) AttributeTypes

func (o ObjectValue) AttributeTypes(_ context.Context) map[string]attr.Type

AttributeTypes returns a copy of the mapping of attribute types for the Object.

func (ObjectValue) Attributes

func (o ObjectValue) Attributes() map[string]attr.Value

Attributes returns a copy of the mapping of known attribute values for the Object.

func (ObjectValue) Equal

func (o ObjectValue) Equal(c attr.Value) bool

Equal returns true if the given attr.Value is also an ObjectValue, has the same value state, and contains exactly the same attribute types/values as defined by the Equal method of those underlying types/values.

func (ObjectValue) IsNull

func (o ObjectValue) IsNull() bool

IsNull returns true if the Object represents a null value.

func (ObjectValue) IsUnknown

func (o ObjectValue) IsUnknown() bool

IsUnknown returns true if the Object represents a currently unknown value.

func (ObjectValue) String

func (o ObjectValue) String() string

String returns a human-readable representation of the Object value. The string returned here is not protected by any compatibility guarantees, and is intended for logging and error reporting.

func (ObjectValue) ToObjectValue

func (o ObjectValue) ToObjectValue(context.Context) (ObjectValue, diag.Diagnostics)

ToObjectValue returns the Object.

func (ObjectValue) ToTerraformValue

func (o ObjectValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error)

ToTerraformValue returns the data contained in the attr.Value as a tftypes.Value.

func (ObjectValue) Type

func (o ObjectValue) Type(ctx context.Context) attr.Type

Type returns an ObjectType with the same attribute types as `o`.

type SetTypable

type SetTypable interface {
	attr.Type

	// ValueFromSet should convert the Set to a SetValuable type.
	ValueFromSet(context.Context, SetValue) (SetValuable, diag.Diagnostics)
}

SetTypable extends attr.Type for set types. Implement this interface to create a custom SetType type.

type SetType

type SetType struct {
	ElemType attr.Type
}

SetType is an AttributeType representing a set of values. All values must be of the same type, which the provider must specify as the ElemType property.

func (SetType) ApplyTerraform5AttributePathStep

func (st SetType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)

ApplyTerraform5AttributePathStep applies the given AttributePathStep to the set.

func (SetType) ElementType

func (st SetType) ElementType() attr.Type

ElementType returns the attr.Type elements will be created from.

func (SetType) Equal

func (st SetType) Equal(o attr.Type) bool

Equal returns true if `o` is also a SetType and has the same ElemType.

func (SetType) String

func (st SetType) String() string

String returns a human-friendly description of the SetType.

func (SetType) TerraformType

func (st SetType) TerraformType(ctx context.Context) tftypes.Type

TerraformType returns the tftypes.Type that should be used to represent this type. This constrains what user input will be accepted and what kind of data can be set in state. The framework will use this to translate the AttributeType to something Terraform can understand.

func (SetType) Validate

func (st SetType) Validate(ctx context.Context, in tftypes.Value, path path.Path) diag.Diagnostics

Validate implements type validation. This type requires all elements to be unique.

func (SetType) ValueFromSet

func (st SetType) ValueFromSet(_ context.Context, set SetValue) (SetValuable, diag.Diagnostics)

ValueFromSet returns a SetValuable type given a Set.

func (SetType) ValueFromTerraform

func (st SetType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform returns an attr.Value given a tftypes.Value. This is meant to convert the tftypes.Value into a more convenient Go type for the provider to consume the data with.

func (SetType) ValueType

func (st SetType) ValueType(_ context.Context) attr.Value

ValueType returns the Value type.

func (SetType) WithElementType

func (st SetType) WithElementType(typ attr.Type) attr.TypeWithElementType

WithElementType returns a SetType that is identical to `l`, but with the element type set to `typ`.

type SetValuable

type SetValuable interface {
	attr.Value

	// ToSetValue should convert the value type to a Set.
	ToSetValue(ctx context.Context) (SetValue, diag.Diagnostics)
}

SetValuable extends attr.Value for set value types. Implement this interface to create a custom Set value type.

type SetValuableWithSemanticEquals added in v1.3.0

type SetValuableWithSemanticEquals interface {
	SetValuable

	// SetSemanticEquals should return true if the given value is
	// semantically equal to the current value. This logic is used to prevent
	// Terraform data consistency errors and resource drift where a value change
	// may have inconsequential differences, such as computed elements added by
	// a remote system.
	//
	// Only known values are compared with this method as changing a value's
	// state implicitly represents a different value.
	SetSemanticEquals(context.Context, SetValuable) (bool, diag.Diagnostics)
}

SetValuableWithSemanticEquals extends SetValuable with semantic equality logic.

type SetValue

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

SetValue represents a set of attr.Value, all of the same type, indicated by ElemType.

func NewSetNull

func NewSetNull(elementType attr.Type) SetValue

NewSetNull creates a Set with a null value. Determine whether the value is null via the Set type IsNull method.

func NewSetUnknown

func NewSetUnknown(elementType attr.Type) SetValue

NewSetUnknown creates a Set with an unknown value. Determine whether the value is unknown via the Set type IsUnknown method.

func NewSetValue

func NewSetValue(elementType attr.Type, elements []attr.Value) (SetValue, diag.Diagnostics)

NewSetValue creates a Set with a known value. Access the value via the Set type Elements or ElementsAs methods.

func NewSetValueFrom

func NewSetValueFrom(ctx context.Context, elementType attr.Type, elements any) (SetValue, diag.Diagnostics)

NewSetValueFrom creates a Set with a known value, using reflection rules. The elements must be a slice which can convert into the given element type. Access the value via the Set type Elements or ElementsAs methods.

func NewSetValueMust

func NewSetValueMust(elementType attr.Type, elements []attr.Value) SetValue

NewSetValueMust creates a Set with a known value, converting any diagnostics into a panic at runtime. Access the value via the Set type Elements or ElementsAs methods.

This creation function is only recommended to create Set values which will not potentially effect practitioners, such as testing, or exhaustively tested provider logic.

func (SetValue) ElementType

func (s SetValue) ElementType(_ context.Context) attr.Type

ElementType returns the element type for the Set.

func (SetValue) Elements

func (s SetValue) Elements() []attr.Value

Elements returns a copy of the collection of elements for the Set.

func (SetValue) ElementsAs

func (s SetValue) ElementsAs(ctx context.Context, target interface{}, allowUnhandled bool) diag.Diagnostics

ElementsAs populates `target` with the elements of the SetValue, throwing an error if the elements cannot be stored in `target`.

func (SetValue) Equal

func (s SetValue) Equal(o attr.Value) bool

Equal returns true if the given attr.Value is also a SetValue, has the same element type, same value state, and contains exactly the element values as defined by the Equal method of the element type.

func (SetValue) IsNull

func (s SetValue) IsNull() bool

IsNull returns true if the Set represents a null value.

func (SetValue) IsUnknown

func (s SetValue) IsUnknown() bool

IsUnknown returns true if the Set represents a currently unknown value. Returns false if the Set has a known number of elements, even if all are unknown values.

func (SetValue) String

func (s SetValue) String() string

String returns a human-readable representation of the Set value. The string returned here is not protected by any compatibility guarantees, and is intended for logging and error reporting.

func (SetValue) ToSetValue

func (s SetValue) ToSetValue(context.Context) (SetValue, diag.Diagnostics)

ToSetValue returns the Set.

func (SetValue) ToTerraformValue

func (s SetValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error)

ToTerraformValue returns the data contained in the Set as a tftypes.Value.

func (SetValue) Type

func (s SetValue) Type(ctx context.Context) attr.Type

Type returns a SetType with the same element type as `s`.

type StringTypable

type StringTypable interface {
	attr.Type

	// ValueFromString should convert the String to a StringValuable type.
	ValueFromString(context.Context, StringValue) (StringValuable, diag.Diagnostics)
}

StringTypable extends attr.Type for string types. Implement this interface to create a custom StringType type.

type StringType

type StringType struct{}

StringType is the base framework type for a string. StringValue is the associated value type.

func (StringType) ApplyTerraform5AttributePathStep

func (t StringType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)

ApplyTerraform5AttributePathStep applies the given AttributePathStep to the type.

func (StringType) Equal

func (t StringType) Equal(o attr.Type) bool

Equal returns true if the given type is equivalent.

func (StringType) String

func (t StringType) String() string

String returns a human readable string of the type name.

func (StringType) TerraformType

func (t StringType) TerraformType(_ context.Context) tftypes.Type

TerraformType returns the tftypes.Type that should be used to represent this framework type.

func (StringType) ValueFromString

ValueFromString returns a StringValuable type given a StringValue.

func (StringType) ValueFromTerraform

func (t StringType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)

ValueFromTerraform returns a Value given a tftypes.Value. This is meant to convert the tftypes.Value into a more convenient Go type for the provider to consume the data with.

func (StringType) ValueType

func (t StringType) ValueType(_ context.Context) attr.Value

ValueType returns the Value type.

type StringValuable

type StringValuable interface {
	attr.Value

	// ToStringValue should convert the value type to a String.
	ToStringValue(ctx context.Context) (StringValue, diag.Diagnostics)
}

StringValuable extends attr.Value for string value types. Implement this interface to create a custom String value type.

type StringValuableWithSemanticEquals added in v1.3.0

type StringValuableWithSemanticEquals interface {
	StringValuable

	// StringSemanticEquals should return true if the given value is
	// semantically equal to the current value. This logic is used to prevent
	// Terraform data consistency errors and resource drift where a value change
	// may have inconsequential differences, such as spacing character removal
	// in JSON formatted strings.
	//
	// Only known values are compared with this method as changing a value's
	// state implicitly represents a different value.
	StringSemanticEquals(context.Context, StringValuable) (bool, diag.Diagnostics)
}

StringValuableWithSemanticEquals extends StringValuable with semantic equality logic.

type StringValue

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

StringValue represents a UTF-8 string value.

func NewStringNull

func NewStringNull() StringValue

NewStringNull creates a String with a null value. Determine whether the value is null via the String type IsNull method.

Setting the deprecated String type Null, Unknown, or Value fields after creating a String with this function has no effect.

func NewStringPointerValue added in v1.2.0

func NewStringPointerValue(value *string) StringValue

NewStringPointerValue creates a String with a null value if nil or a known value. Access the value via the String type ValueStringPointer method.

func NewStringUnknown

func NewStringUnknown() StringValue

NewStringUnknown creates a String with an unknown value. Determine whether the value is unknown via the String type IsUnknown method.

Setting the deprecated String type Null, Unknown, or Value fields after creating a String with this function has no effect.

func NewStringValue

func NewStringValue(value string) StringValue

NewStringValue creates a String with a known value. Access the value via the String type ValueString method.

Setting the deprecated String type Null, Unknown, or Value fields after creating a String with this function has no effect.

func (StringValue) Equal

func (s StringValue) Equal(other attr.Value) bool

Equal returns true if `other` is a String and has the same value as `s`.

func (StringValue) IsNull

func (s StringValue) IsNull() bool

IsNull returns true if the String represents a null value.

func (StringValue) IsUnknown

func (s StringValue) IsUnknown() bool

IsUnknown returns true if the String represents a currently unknown value.

func (StringValue) String

func (s StringValue) String() string

String returns a human-readable representation of the String value. Use the ValueString method for Terraform data handling instead.

The string returned here is not protected by any compatibility guarantees, and is intended for logging and error reporting.

func (StringValue) ToStringValue

func (s StringValue) ToStringValue(context.Context) (StringValue, diag.Diagnostics)

ToStringValue returns String.

func (StringValue) ToTerraformValue

func (s StringValue) ToTerraformValue(_ context.Context) (tftypes.Value, error)

ToTerraformValue returns the data contained in the *String as a tftypes.Value.

func (StringValue) Type

func (s StringValue) Type(_ context.Context) attr.Type

Type returns a StringType.

func (StringValue) ValueString

func (s StringValue) ValueString() string

ValueString returns the known string value. If String is null or unknown, returns "".

func (StringValue) ValueStringPointer added in v1.2.0

func (s StringValue) ValueStringPointer() *string

ValueStringPointer returns a pointer to the known string value, nil for a null value, or a pointer to "" for an unknown value.

Jump to

Keyboard shortcuts

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