Documentation
¶
Overview ¶
Package types contains the framework-defined data types and values, such as boolean, floating point, integer, list, map, object, set, and string. These types can be extended by providers for custom use cases.
Index ¶
- Constants
- type Bool
- type Float64
- func (f Float64) Equal(other attr.Value) bool
- func (f Float64) IsNull() bool
- func (f Float64) IsUnknown() bool
- func (f Float64) String() string
- func (f Float64) ToTerraformValue(ctx context.Context) (tftypes.Value, error)
- func (f Float64) Type(ctx context.Context) attr.Type
- func (f Float64) ValueFloat64() float64
- type Int64
- type List
- func ListNull(elementType attr.Type) List
- func ListUnknown(elementType attr.Type) List
- func ListValue(elementType attr.Type, elements []attr.Value) (List, diag.Diagnostics)
- func ListValueFrom(ctx context.Context, elementType attr.Type, elements any) (List, diag.Diagnostics)
- func ListValueMust(elementType attr.Type, elements []attr.Value) List
- func (l List) ElementType(_ context.Context) attr.Type
- func (l List) Elements() []attr.Value
- func (l List) ElementsAs(ctx context.Context, target interface{}, allowUnhandled bool) diag.Diagnostics
- func (l List) Equal(o attr.Value) bool
- func (l List) IsNull() bool
- func (l List) IsUnknown() bool
- func (l List) String() string
- func (l List) ToTerraformValue(ctx context.Context) (tftypes.Value, error)
- func (l List) Type(ctx context.Context) attr.Type
- type ListType
- func (l ListType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)
- func (l ListType) ElementType() attr.Type
- func (l ListType) Equal(o attr.Type) bool
- func (l ListType) String() string
- func (l ListType) TerraformType(ctx context.Context) tftypes.Type
- func (l ListType) Validate(ctx context.Context, in tftypes.Value, path path.Path) diag.Diagnostics
- func (l ListType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t ListType) ValueType(_ context.Context) attr.Value
- func (l ListType) WithElementType(typ attr.Type) attr.TypeWithElementType
- type Map
- func MapNull(elementType attr.Type) Map
- func MapUnknown(elementType attr.Type) Map
- func MapValue(elementType attr.Type, elements map[string]attr.Value) (Map, diag.Diagnostics)
- func MapValueFrom(ctx context.Context, elementType attr.Type, elements any) (Map, diag.Diagnostics)
- func MapValueMust(elementType attr.Type, elements map[string]attr.Value) Map
- func (m Map) ElementType(_ context.Context) attr.Type
- func (m Map) Elements() map[string]attr.Value
- func (m Map) ElementsAs(ctx context.Context, target interface{}, allowUnhandled bool) diag.Diagnostics
- func (m Map) Equal(o attr.Value) bool
- func (m Map) IsNull() bool
- func (m Map) IsUnknown() bool
- func (m Map) String() string
- func (m Map) ToTerraformValue(ctx context.Context) (tftypes.Value, error)
- func (m Map) Type(ctx context.Context) attr.Type
- type MapType
- func (m MapType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)
- func (m MapType) ElementType() attr.Type
- func (m MapType) Equal(o attr.Type) bool
- func (m MapType) String() string
- func (m MapType) TerraformType(ctx context.Context) tftypes.Type
- func (m MapType) Validate(ctx context.Context, in tftypes.Value, path path.Path) diag.Diagnostics
- func (m MapType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t MapType) ValueType(_ context.Context) attr.Value
- func (m MapType) WithElementType(typ attr.Type) attr.TypeWithElementType
- type Number
- func (n Number) Equal(other attr.Value) bool
- func (n Number) IsNull() bool
- func (n Number) IsUnknown() bool
- func (n Number) String() string
- func (n Number) ToTerraformValue(_ context.Context) (tftypes.Value, error)
- func (n Number) Type(_ context.Context) attr.Type
- func (n Number) ValueBigFloat() *big.Float
- type Object
- func ObjectNull(attributeTypes map[string]attr.Type) Object
- func ObjectUnknown(attributeTypes map[string]attr.Type) Object
- func ObjectValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (Object, diag.Diagnostics)
- func ObjectValueFrom(ctx context.Context, attributeTypes map[string]attr.Type, attributes any) (Object, diag.Diagnostics)
- func ObjectValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) Object
- func (o Object) As(ctx context.Context, target interface{}, opts ObjectAsOptions) diag.Diagnostics
- func (o Object) AttributeTypes(_ context.Context) map[string]attr.Type
- func (o Object) Attributes() map[string]attr.Value
- func (o Object) Equal(c attr.Value) bool
- func (o Object) IsNull() bool
- func (o Object) IsUnknown() bool
- func (o Object) String() string
- func (o Object) ToTerraformValue(ctx context.Context) (tftypes.Value, error)
- func (o Object) Type(ctx context.Context) attr.Type
- type ObjectAsOptions
- type ObjectType
- func (o ObjectType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)
- func (o ObjectType) AttributeTypes() map[string]attr.Type
- func (o ObjectType) Equal(candidate attr.Type) bool
- func (o ObjectType) String() string
- func (o ObjectType) TerraformType(ctx context.Context) tftypes.Type
- func (o ObjectType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t ObjectType) ValueType(_ context.Context) attr.Value
- func (o ObjectType) WithAttributeTypes(typs map[string]attr.Type) attr.TypeWithAttributeTypes
- type Set
- func SetNull(elementType attr.Type) Set
- func SetUnknown(elementType attr.Type) Set
- func SetValue(elementType attr.Type, elements []attr.Value) (Set, diag.Diagnostics)
- func SetValueFrom(ctx context.Context, elementType attr.Type, elements any) (Set, diag.Diagnostics)
- func SetValueMust(elementType attr.Type, elements []attr.Value) Set
- func (s Set) ElementType(_ context.Context) attr.Type
- func (s Set) Elements() []attr.Value
- func (s Set) ElementsAs(ctx context.Context, target interface{}, allowUnhandled bool) diag.Diagnostics
- func (s Set) Equal(o attr.Value) bool
- func (s Set) IsNull() bool
- func (s Set) IsUnknown() bool
- func (s Set) String() string
- func (s Set) ToTerraformValue(ctx context.Context) (tftypes.Value, error)
- func (s Set) Type(ctx context.Context) attr.Type
- type SetType
- func (st SetType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)
- func (st SetType) ElementType() attr.Type
- func (st SetType) Equal(o attr.Type) bool
- func (st SetType) String() string
- func (st SetType) TerraformType(ctx context.Context) tftypes.Type
- func (st SetType) Validate(ctx context.Context, in tftypes.Value, path path.Path) diag.Diagnostics
- func (st SetType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error)
- func (t SetType) ValueType(_ context.Context) attr.Value
- func (st SetType) WithElementType(typ attr.Type) attr.TypeWithElementType
- type String
- func (s String) Equal(other attr.Value) bool
- func (s String) IsNull() bool
- func (s String) IsUnknown() bool
- func (s String) String() string
- func (s String) ToTerraformValue(_ context.Context) (tftypes.Value, error)
- func (s String) Type(_ context.Context) attr.Type
- func (s String) ValueString() string
Constants ¶
const ( // StringType represents a UTF-8 string type. StringType primitive = iota // NumberType represents a number type, either an integer or a float. NumberType // BoolType represents a boolean type. BoolType // Int64Type represents a 64-bit integer. Int64Type // Float64Type represents a 64-bit floating point. Float64Type )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool struct { // Unknown will be true if the value is not yet known. // // If the Bool was created with the BoolValue, BoolNull, or BoolUnknown // functions, changing this field has no effect. // // Deprecated: Use the BoolUnknown function to create an unknown Bool // value or use the IsUnknown method to determine whether the Bool value // is unknown instead. Unknown bool // Null will be true if the value was not set, or was explicitly set to // null. // // If the Bool was created with the BoolValue, BoolNull, or BoolUnknown // functions, changing this field has no effect. // // Deprecated: Use the BoolNull function to create a null Bool value or // use the IsNull method to determine whether the Bool value is null // instead. Null bool // Value contains the set value, as long as Unknown and Null are both // false. // // If the Bool was created with the BoolValue, BoolNull, or BoolUnknown // functions, changing this field has no effect. // // Deprecated: Use the BoolValue function to create a known Bool value or // use the ValueBool method to retrieve the Bool value instead. Value bool // contains filtered or unexported fields }
Bool represents a boolean value.
func BoolNull ¶ added in v0.15.0
func BoolNull() Bool
BoolNull creates a Bool with a null value. Determine whether the value is null via the Bool type IsNull method.
Setting the deprecated Bool type Null, Unknown, or Value fields after creating a Bool with this function has no effect.
func BoolUnknown ¶ added in v0.15.0
func BoolUnknown() Bool
BoolUnknown creates a Bool with an unknown value. Determine whether the value is unknown via the Bool type IsUnknown method.
Setting the deprecated Bool type Null, Unknown, or Value fields after creating a Bool with this function has no effect.
func BoolValue ¶ added in v0.15.0
BoolValue creates a Bool with a known value. Access the value via the Bool type ValueBool method.
Setting the deprecated Bool type Null, Unknown, or Value fields after creating a Bool with this function has no effect.
func (Bool) IsUnknown ¶ added in v0.9.0
IsUnknown returns true if the Bool represents a currently unknown value.
func (Bool) String ¶ added in v0.9.0
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 (Bool) ToTerraformValue ¶
ToTerraformValue returns the data contained in the Bool as a tftypes.Value.
type Float64 ¶ added in v0.4.0
type Float64 struct { // Unknown will be true if the value is not yet known. // // If the Float64 was created with the Float64Value, Float64Null, or Float64Unknown // functions, changing this field has no effect. // // Deprecated: Use the Float64Unknown function to create an unknown Float64 // value or use the IsUnknown method to determine whether the Float64 value // is unknown instead. Unknown bool // Null will be true if the value was not set, or was explicitly set to // null. // // If the Float64 was created with the Float64Value, Float64Null, or Float64Unknown // functions, changing this field has no effect. // // Deprecated: Use the Float64Null function to create a null Float64 value or // use the IsNull method to determine whether the Float64 value is null // instead. Null bool // Value contains the set value, as long as Unknown and Null are both // false. // // If the Float64 was created with the Float64Value, Float64Null, or Float64Unknown // functions, changing this field has no effect. // // Deprecated: Use the Float64Value function to create a known Float64 value or // use the ValueFloat64 method to retrieve the Float64 value instead. Value float64 // contains filtered or unexported fields }
Float64 represents a 64-bit floating point value, exposed as a float64.
func Float64Null ¶ added in v0.15.0
func Float64Null() Float64
Float64Null creates a Float64 with a null value. Determine whether the value is null via the Float64 type IsNull method.
Setting the deprecated Float64 type Null, Unknown, or Value fields after creating a Float64 with this function has no effect.
func Float64Unknown ¶ added in v0.15.0
func Float64Unknown() Float64
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 Float64Value ¶ added in v0.15.0
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 (Float64) Equal ¶ added in v0.4.0
Equal returns true if `other` is a Float64 and has the same value as `f`.
func (Float64) IsUnknown ¶ added in v0.9.0
IsUnknown returns true if the Float64 represents a currently unknown value.
func (Float64) String ¶ added in v0.9.0
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 (Float64) ToTerraformValue ¶ added in v0.4.0
ToTerraformValue returns the data contained in the Float64 as a tftypes.Value.
func (Float64) ValueFloat64 ¶ added in v0.15.0
ValueFloat64 returns the known float64 value. If Float64 is null or unknown, returns 0.0.
type Int64 ¶ added in v0.4.0
type Int64 struct { // Unknown will be true if the value is not yet known. // // If the Int64 was created with the Int64Value, Int64Null, or Int64Unknown // functions, changing this field has no effect. // // Deprecated: Use the Int64Unknown function to create an unknown Int64 // value or use the IsUnknown method to determine whether the Int64 value // is unknown instead. Unknown bool // Null will be true if the value was not set, or was explicitly set to // null. // // If the Int64 was created with the Int64Value, Int64Null, or Int64Unknown // functions, changing this field has no effect. // // Deprecated: Use the Int64Null function to create a null Int64 value or // use the IsNull method to determine whether the Int64 value is null // instead. Null bool // Value contains the set value, as long as Unknown and Null are both // false. // // If the Int64 was created with the Int64Value, Int64Null, or Int64Unknown // functions, changing this field has no effect. // // Deprecated: Use the Int64Value function to create a known Int64 value or // use the ValueInt64 method to retrieve the Int64 value instead. Value int64 // contains filtered or unexported fields }
Int64 represents a 64-bit integer value, exposed as an int64.
func Int64Null ¶ added in v0.15.0
func Int64Null() Int64
Int64Null creates a Int64 with a null value. Determine whether the value is null via the Int64 type IsNull method.
Setting the deprecated Int64 type Null, Unknown, or Value fields after creating a Int64 with this function has no effect.
func Int64Unknown ¶ added in v0.15.0
func Int64Unknown() Int64
Int64Unknown creates a Int64 with an unknown value. Determine whether the value is unknown via the Int64 type IsUnknown method.
Setting the deprecated Int64 type Null, Unknown, or Value fields after creating a Int64 with this function has no effect.
func Int64Value ¶ added in v0.15.0
Int64Value creates a Int64 with a known value. Access the value via the Int64 type ValueInt64 method.
Setting the deprecated Int64 type Null, Unknown, or Value fields after creating a Int64 with this function has no effect.
func (Int64) Equal ¶ added in v0.4.0
Equal returns true if `other` is an Int64 and has the same value as `i`.
func (Int64) IsUnknown ¶ added in v0.9.0
IsUnknown returns true if the Int64 represents a currently unknown value.
func (Int64) String ¶ added in v0.9.0
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 (Int64) ToTerraformValue ¶ added in v0.4.0
ToTerraformValue returns the data contained in the Int64 as a tftypes.Value.
func (Int64) ValueInt64 ¶ added in v0.15.0
ValueInt64 returns the known float64 value. If Int64 is null or unknown, returns 0.0.
type List ¶
type List struct { // Unknown will be set to true if the entire list is an unknown value. // If only some of the elements in the list are unknown, their known or // unknown status will be represented however that attr.Value // surfaces that information. The List's Unknown property only tracks // if the number of elements in a List is known, not whether the // elements that are in the list are known. // // If the List was created with the ListValue, ListNull, or ListUnknown // functions, changing this field has no effect. // // Deprecated: Use the ListUnknown function to create an unknown List // value or use the IsUnknown method to determine whether the List value // is unknown instead. Unknown bool // Null will be set to true if the list is null, either because it was // omitted from the configuration, state, or plan, or because it was // explicitly set to null. // // If the List was created with the ListValue, ListNull, or ListUnknown // functions, changing this field has no effect. // // Deprecated: Use the ListNull function to create a null List value or // use the IsNull method to determine whether the List value is null // instead. Null bool // Elems are the elements in the list. // // If the List was created with the ListValue, ListNull, or ListUnknown // functions, changing this field has no effect. // // Deprecated: Use the ListValue function to create a known List value or // use the Elements or ElementsAs methods to retrieve the List elements // instead. Elems []attr.Value // ElemType is the tftypes.Type of the elements in the list. All // elements in the list must be of this type. // // Deprecated: Use the ListValue, ListNull, or ListUnknown functions // to create a List or use the ElementType method to retrieve the // List element type instead. ElemType attr.Type // contains filtered or unexported fields }
List represents a list of attr.Values, all of the same type, indicated by ElemType.
func ListNull ¶ added in v0.15.0
ListNull creates a List with a null value. Determine whether the value is null via the List type IsNull method.
Setting the deprecated List type ElemType, Elems, Null, or Unknown fields after creating a List with this function has no effect.
func ListUnknown ¶ added in v0.15.0
ListUnknown creates a List with an unknown value. Determine whether the value is unknown via the List type IsUnknown method.
Setting the deprecated List type ElemType, Elems, Null, or Unknown fields after creating a List with this function has no effect.
func ListValue ¶ added in v0.15.0
ListValue creates a List with a known value. Access the value via the List type Elements or ElementsAs methods.
Setting the deprecated List type ElemType, Elems, Null, or Unknown fields after creating a List with this function has no effect.
func ListValueFrom ¶ added in v0.15.0
func ListValueFrom(ctx context.Context, elementType attr.Type, elements any) (List, diag.Diagnostics)
ListValueFrom 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 ListValueMust ¶ added in v0.15.0
ListValueMust 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 effect practitioners, such as testing, or exhaustively tested provider logic.
Setting the deprecated List type ElemType, Elems, Null, or Unknown fields after creating a List with this function has no effect.
func (List) ElementType ¶ added in v0.15.0
ElementType returns the element type for the List.
func (List) Elements ¶ added in v0.15.0
Elements returns the collection of elements for the List. Returns nil if the List is null or unknown.
func (List) ElementsAs ¶
func (l List) ElementsAs(ctx context.Context, target interface{}, allowUnhandled bool) diag.Diagnostics
ElementsAs populates `target` with the elements of the List, throwing an error if the elements cannot be stored in `target`.
func (List) Equal ¶
Equal returns true if the List is considered semantically equal (same type and same value) to the attr.Value passed as an argument.
func (List) IsUnknown ¶ added in v0.9.0
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 (List) String ¶ added in v0.9.0
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 (List) ToTerraformValue ¶
ToTerraformValue returns the data contained in the List as a tftypes.Value.
type ListType ¶
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 ¶
ElementType returns the attr.Type elements will be created from.
func (ListType) String ¶ added in v0.4.0
String returns a human-friendly description of the ListType.
func (ListType) TerraformType ¶
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 ¶ added in v0.13.0
Validate validates all elements of the list that are of type xattr.TypeWithValidate.
func (ListType) ValueFromTerraform ¶
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) 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 Map ¶
type Map struct { // Unknown will be set to true if the entire map is an unknown value. // If only some of the elements in the map are unknown, their known or // unknown status will be represented however that attr.Value // surfaces that information. The Map's Unknown property only tracks if // the number of elements in a Map is known, not whether the elements // that are in the map are known. // // If the Map was created with the MapValue, MapNull, or MapUnknown // functions, changing this field has no effect. // // Deprecated: Use the MapUnknown function to create an unknown Map // value or use the IsUnknown method to determine whether the Map value // is unknown instead. Unknown bool // Null will be set to true if the map is null, either because it was // omitted from the configuration, state, or plan, or because it was // explicitly set to null. // // If the Map was created with the MapValue, MapNull, or MapUnknown // functions, changing this field has no effect. // // Deprecated: Use the MapNull function to create a null Map value or // use the IsNull method to determine whether the Map value is null // instead. Null bool // Elems are the elements in the map. // // If the Map was created with the MapValue, MapNull, or MapUnknown // functions, changing this field has no effect. // // Deprecated: Use the MapValue function to create a known Map value or // use the Elements or ElementsAs methods to retrieve the Map elements // instead. Elems map[string]attr.Value // ElemType is the AttributeType of the elements in the map. All // elements in the map must be of this type. // // Deprecated: Use the MapValue, MapNull, or MapUnknown functions // to create a Map or use the ElementType method to retrieve the // Map element type instead. ElemType attr.Type // contains filtered or unexported fields }
Map represents a mapping of string keys to attr.Value values of a single type.
func MapNull ¶ added in v0.15.0
MapNull creates a Map with a null value. Determine whether the value is null via the Map type IsNull method.
Setting the deprecated Map type ElemType, Elems, Null, or Unknown fields after creating a Map with this function has no effect.
func MapUnknown ¶ added in v0.15.0
MapUnknown creates a Map with an unknown value. Determine whether the value is unknown via the Map type IsUnknown method.
Setting the deprecated Map type ElemType, Elems, Null, or Unknown fields after creating a Map with this function has no effect.
func MapValue ¶ added in v0.15.0
MapValue creates a Map with a known value. Access the value via the Map type Elements or ElementsAs methods.
Setting the deprecated Map type ElemType, Elems, Null, or Unknown fields after creating a Map with this function has no effect.
func MapValueFrom ¶ added in v0.15.0
MapValueFrom 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 MapValueMust ¶ added in v0.15.0
MapValueMust 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.
Setting the deprecated Map type ElemType, Elems, Null, or Unknown fields after creating a Map with this function has no effect.
func (Map) ElementType ¶ added in v0.15.0
ElementType returns the element type for the Map.
func (Map) Elements ¶ added in v0.15.0
Elements returns the mapping of elements for the Map. Returns nil if the Map is null or unknown.
func (Map) ElementsAs ¶
func (m Map) ElementsAs(ctx context.Context, target interface{}, allowUnhandled bool) diag.Diagnostics
ElementsAs populates `target` with the elements of the Map, throwing an error if the elements cannot be stored in `target`.
func (Map) Equal ¶
Equal returns true if the Map is considered semantically equal (same type and same value) to the attr.Value passed as an argument.
func (Map) IsUnknown ¶ added in v0.9.0
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 (Map) String ¶ added in v0.9.0
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 (Map) ToTerraformValue ¶
ToTerraformValue returns the data contained in the List as a tftypes.Value.
type MapType ¶
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 ¶
ElementType returns the type's element type.
func (MapType) TerraformType ¶
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 ¶ added in v0.13.0
Validate validates all elements of the map that are of type xattr.TypeWithValidate.
func (MapType) ValueFromTerraform ¶
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) WithElementType ¶
func (m MapType) WithElementType(typ attr.Type) attr.TypeWithElementType
WithElementType returns a new copy of the type with its element type set.
type Number ¶
type Number struct { // Unknown will be true if the value is not yet known. // // If the Number was created with the NumberValue, NumberNull, or NumberUnknown // functions, changing this field has no effect. // // Deprecated: Use the NumberUnknown function to create an unknown Number // value or use the IsUnknown method to determine whether the Number value // is unknown instead. Unknown bool // Null will be true if the value was not set, or was explicitly set to // null. // // If the Number was created with the NumberValue, NumberNull, or NumberUnknown // functions, changing this field has no effect. // // Deprecated: Use the NumberNull function to create a null Number value or // use the IsNull method to determine whether the Number value is null // instead. Null bool // Value contains the set value, as long as Unknown and Null are both // false. // // If the Number was created with the NumberValue, NumberNull, or NumberUnknown // functions, changing this field has no effect. // // Deprecated: Use the NumberValue function to create a known Number value or // use the ValueBigFloat method to retrieve the Number value instead. Value *big.Float // contains filtered or unexported fields }
Number represents a number value, exposed as a *big.Float. Numbers can be floats or integers.
func NumberNull ¶ added in v0.15.0
func NumberNull() Number
NumberNull creates a Number with a null value. Determine whether the value is null via the Number type IsNull method.
Setting the deprecated Number type Null, Unknown, or Value fields after creating a Number with this function has no effect.
func NumberUnknown ¶ added in v0.15.0
func NumberUnknown() Number
NumberUnknown creates a Number with an unknown value. Determine whether the value is unknown via the Number type IsUnknown method.
Setting the deprecated Number type Null, Unknown, or Value fields after creating a Number with this function has no effect.
func NumberValue ¶ added in v0.15.0
NumberValue 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.
Setting the deprecated Number type Null, Unknown, or Value fields after creating a Number with this function has no effect.
func (Number) IsUnknown ¶ added in v0.9.0
IsUnknown returns true if the Number represents a currently unknown value.
func (Number) String ¶ added in v0.9.0
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 (Number) ToTerraformValue ¶
ToTerraformValue returns the data contained in the Number as a tftypes.Value.
func (Number) ValueBigFloat ¶ added in v0.15.0
ValueBigFloat returns the known *big.Float value. If Number is null or unknown, returns 0.0.
type Object ¶
type Object struct { // Unknown will be set to true if the entire object is an unknown value. // If only some of the elements in the object are unknown, their known or // unknown status will be represented however that attr.Value // surfaces that information. The Object's Unknown property only tracks // if the number of elements in a Object is known, not whether the // elements that are in the object are known. // // If the Object was created with the ObjectValue, ObjectNull, or ObjectUnknown // functions, changing this field has no effect. // // Deprecated: Use the ObjectNull function to create a null Object value or // use the IsNull method to determine whether the Object value is null // instead. Unknown bool // Null will be set to true if the object is null, either because it was // omitted from the configuration, state, or plan, or because it was // explicitly set to null. // // If the Object was created with the ObjectValue, ObjectNull, or ObjectUnknown // functions, changing this field has no effect. // // Deprecated: Use the ObjectNull function to create a null Object value or // use the IsNull method to determine whether the Object value is null // instead. Null bool // Attrs is the mapping of known attribute values in the Object. // // If the Object was created with the ObjectValue, ObjectNull, or ObjectUnknown // functions, changing this field has no effect. // // Deprecated: Use the ObjectValue function to create a known Object value or // use the As or Attributes methods to retrieve the Object attributes // instead. Attrs map[string]attr.Value // AttrTypes is the mapping of attribute types in the Object. Required // for a valid Object. // // Deprecated: Use the ObjectValue, ObjectNull, or ObjectUnknown functions // to create a Object or use the AttributeTypes method to retrieve the // Object attribute types instead. AttrTypes map[string]attr.Type // contains filtered or unexported fields }
Object represents an object
func ObjectNull ¶ added in v0.15.0
ObjectNull creates a Object with a null value. Determine whether the value is null via the Object type IsNull method.
Setting the deprecated Object type AttrTypes, Attrs, Null, or Unknown fields after creating a Object with this function has no effect.
func ObjectUnknown ¶ added in v0.15.0
ObjectUnknown creates a Object with an unknown value. Determine whether the value is unknown via the Object type IsUnknown method.
Setting the deprecated Object type AttrTypes, Attrs, Null, or Unknown fields after creating a Object with this function has no effect.
func ObjectValue ¶ added in v0.15.0
func ObjectValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (Object, diag.Diagnostics)
ObjectValue creates a Object with a known value. Access the value via the Object type ElementsAs method.
Setting the deprecated Object type AttrTypes, Attrs, Null, or Unknown fields after creating a Object with this function has no effect.
func ObjectValueFrom ¶ added in v0.15.0
func ObjectValueFrom(ctx context.Context, attributeTypes map[string]attr.Type, attributes any) (Object, diag.Diagnostics)
ObjectValueFrom 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 ObjectValueMust ¶ added in v0.15.0
ObjectValueMust 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.
Objectting the deprecated Object type ElemType, Elems, Null, or Unknown fields after creating a Object with this function has no effect.
func (Object) As ¶
func (o Object) As(ctx context.Context, target interface{}, opts ObjectAsOptions) diag.Diagnostics
As populates `target` with the data in the Object, throwing an error if the data cannot be stored in `target`.
func (Object) AttributeTypes ¶ added in v0.15.0
AttributeTypes returns the mapping of attribute types for the Object.
func (Object) Attributes ¶ added in v0.15.0
Attributes returns the mapping of known attribute values for the Object. Returns nil if the Object is null or unknown.
func (Object) Equal ¶
Equal returns true if the Object is considered semantically equal (same type and same value) to the attr.Value passed as an argument.
func (Object) IsUnknown ¶ added in v0.9.0
IsUnknown returns true if the Object represents a currently unknown value.
func (Object) String ¶ added in v0.9.0
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 (Object) ToTerraformValue ¶
ToTerraformValue returns the data contained in the attr.Value as a tftypes.Value.
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 ObjectType ¶
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 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 ¶ added in v0.4.0
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) ValueFromTerraform ¶
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 ¶ added in v0.14.0
func (t 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 Set ¶ added in v0.4.0
type Set struct { // Unknown will be set to true if the entire set is an unknown value. // If only some of the elements in the set are unknown, their known or // unknown status will be represented however that attr.Value // surfaces that information. The Set's Unknown property only tracks // if the number of elements in a Set is known, not whether the // elements that are in the set are known. // // If the Set was created with the SetValue, SetNull, or SetUnknown // functions, changing this field has no effect. // // Deprecated: Use the SetUnknown function to create an unknown Set // value or use the IsUnknown method to determine whether the Set value // is unknown instead. Unknown bool // Null will be set to true if the set is null, either because it was // omitted from the configuration, state, or plan, or because it was // explicitly set to null. // // If the Set was created with the SetValue, SetNull, or SetUnknown // functions, changing this field has no effect. // // Deprecated: Use the SetNull function to create a null Set value or // use the IsNull method to determine whether the Set value is null // instead. Null bool // Elems are the elements in the set. // // If the Set was created with the SetValue, SetNull, or SetUnknown // functions, changing this field has no effect. // // Deprecated: Use the SetValue function to create a known Set value or // use the Elements or ElementsAs methods to retrieve the Set elements // instead. Elems []attr.Value // ElemType is the tftypes.Type of the elements in the set. All // elements in the set must be of this type. // // Deprecated: Use the SetValue, SetNull, or SetUnknown functions // to create a Set or use the ElementType method to retrieve the // Set element type instead. ElemType attr.Type // contains filtered or unexported fields }
Set represents a set of attr.Value, all of the same type, indicated by ElemType.
func SetNull ¶ added in v0.15.0
SetNull creates a Set with a null value. Determine whether the value is null via the Set type IsNull method.
Setting the deprecated Set type ElemType, Elems, Null, or Unknown fields after creating a Set with this function has no effect.
func SetUnknown ¶ added in v0.15.0
SetUnknown creates a Set with an unknown value. Determine whether the value is unknown via the Set type IsUnknown method.
Setting the deprecated Set type ElemType, Elems, Null, or Unknown fields after creating a Set with this function has no effect.
func SetValue ¶ added in v0.15.0
SetValue creates a Set with a known value. Access the value via the Set type Elements or ElementsAs methods.
Setting the deprecated Set type ElemType, Elems, Null, or Unknown fields after creating a Set with this function has no effect.
func SetValueFrom ¶ added in v0.15.0
SetValueFrom 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 SetValueMust ¶ added in v0.15.0
SetValueMust 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.
Setting the deprecated Set type ElemType, Elems, Null, or Unknown fields after creating a Set with this function has no effect.
func (Set) ElementType ¶ added in v0.15.0
ElementType returns the element type for the Set.
func (Set) Elements ¶ added in v0.15.0
Elements returns the collection of elements for the Set. Returns nil if the Set is null or unknown.
func (Set) ElementsAs ¶ added in v0.4.0
func (s Set) ElementsAs(ctx context.Context, target interface{}, allowUnhandled bool) diag.Diagnostics
ElementsAs populates `target` with the elements of the Set, throwing an error if the elements cannot be stored in `target`.
func (Set) Equal ¶ added in v0.4.0
Equal returns true if the Set is considered semantically equal (same type and same value) to the attr.Value passed as an argument.
func (Set) IsUnknown ¶ added in v0.9.0
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 (Set) String ¶ added in v0.9.0
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 (Set) ToTerraformValue ¶ added in v0.4.0
ToTerraformValue returns the data contained in the Set as a tftypes.Value.
type SetType ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (st SetType) ApplyTerraform5AttributePathStep(step tftypes.AttributePathStep) (interface{}, error)
ApplyTerraform5AttributePathStep applies the given AttributePathStep to the set.
func (SetType) ElementType ¶ added in v0.4.0
ElementType returns the attr.Type elements will be created from.
func (SetType) Equal ¶ added in v0.4.0
Equal returns true if `o` is also a SetType and has the same ElemType.
func (SetType) TerraformType ¶ added in v0.4.0
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 ¶ added in v0.4.0
Validate implements type validation. This type requires all elements to be unique.
func (SetType) ValueFromTerraform ¶ added in v0.4.0
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) WithElementType ¶ added in v0.4.0
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 String ¶
type String struct { // Unknown will be true if the value is not yet known. // // If the String was created with the StringValue, StringNull, or StringUnknown // functions, changing this field has no effect. // // Deprecated: Use the StringUnknown function to create an unknown String // value or use the IsUnknown method to determine whether the String value // is unknown instead. Unknown bool // Null will be true if the value was not set, or was explicitly set to // null. // // If the String was created with the StringValue, StringNull, or StringUnknown // functions, changing this field has no effect. // // Deprecated: Use the StringNull function to create a null String value or // use the IsNull method to determine whether the String value is null // instead. Null bool // Value contains the set value, as long as Unknown and Null are both // false. // // If the String was created with the StringValue, StringNull, or StringUnknown // functions, changing this field has no effect. // // Deprecated: Use the StringValue function to create a known String value or // use the ValueString method to retrieve the String value instead. Value string // contains filtered or unexported fields }
String represents a UTF-8 string value.
func StringNull ¶ added in v0.15.0
func StringNull() String
StringNull 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 StringUnknown ¶ added in v0.15.0
func StringUnknown() String
StringUnknown 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 StringValue ¶ added in v0.15.0
StringValue 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 (String) IsUnknown ¶ added in v0.9.0
IsUnknown returns true if the String represents a currently unknown value.
func (String) String ¶ added in v0.9.0
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 (String) ToTerraformValue ¶
ToTerraformValue returns the data contained in the *String as a tftypes.Value.
func (String) ValueString ¶ added in v0.15.0
ValueString returns the known string value. If String is null or unknown, returns "".