Releases: hashicorp/terraform-plugin-go
Releases · hashicorp/terraform-plugin-go
v0.3.1
BUG FIXES
- Fixed AttributePaths pointing to the root of the value to be omitted instead of prefixing the error with
:
. (#87) - Fixed a panic when
.String()
is called on an emptytftypes.Value
. (#86) - Fixed a panic when calling
tftypes.Value.As
and passing a pointer to an uninstantiated *big.Float. (#85) - Fixed a panic when calling
tftypes.Value.As
and passing a pointer to an uninstantiated *bool, *string, *map[string]Value or *[]Value. (#88) - Fixed a panic when comparing the empty value of a tftypes.Value to a non-empty value. (#90)
v0.3.0
BREAKING CHANGES:
- Previously,
tftypes.NewValue
would panic if the Go type supplied wasn't a valid Go type for anytftypes.Type
. Nowtftypes.NewValue
will panic if the Go type supplied isn't a valid Go type for the specifictftypes.Type
supplied. (#67) - Removed support for
*float32
(andfloat32
, which was only documented and never implemented) when creating atftypes.Number
usingtftypes.NewValue
. We can't find a lossless way to convert afloat32
to a*big.Float
and so require provider developers to choose the lossy conversion they find acceptable. (#67) - Removed the now-unnecessary
tftypes.ValueComparer
helper, which helpedgithub.com/google/go-cmp
comparetftypes.Value
s.tftypes.Value
s now have anEqual
method thatgo-cmp
can use, and don't need any special options passed anymore. (#67) - The
tftypes
package has been moved to the root of the module and is no longer under thetfprotov5
package. Providers can automatically rewrite their import paths using a command likesed -i 's/"github.com\/hashicorp\/terraform-plugin-go\/tfprotov5\/tftypes"/"github.com\/hashicorp\/terraform-plugin-go\/tftypes"/g' **/*.go
on Unix-like systems. (#70) - With the release of Go 1.16, Go 1.15 is now the lowest supported version of Go to use with terraform-plugin-go. (#62)
tftypes.AttributePath
is now referenced as a pointer instead of a value pretty much everywhere it is used. This enables much more ergonomic use withtfprotov5.Diagnostic
values. (#68)tftypes.AttributePath
'sSteps
property is now internal-only. Usetftypes.AttributePath.Steps()
to access the list oftftypes.AttributePathSteps
, andtftypes.NewAttributePath
ortftypes.NewAttributePathWithSteps
to create a newtftypes.AttributePath
. (#68)tftypes.String
,tftypes.Number
,tftypes.Bool
, andtftypes.DynamicPseudoType
are now represented by a different Go type. Uses of==
andswitch
on them will no longer work. The recommended way to compare any type is usingIs
. (#58)tftypes.Value
s no longer have anIs
method. Usetftypes.Value.Type().Is
instead. (#58)- tftypes.AttributePath.WithAttributeName, WithElementKeyString, WithElementKeyInt, and WithElementKeyValue no longer accept pointers and mutate the AttributePath. They now copy the AttributePath, and return a version of it with the new AttributePathStep appended. (#60)
FEATURES:
- Added tftypes.Diff function to return the elements and attributes that are different between two tftypes.Values. (#60)
- Added tftypes.Walk and tftypes.Transform functions for the tftypes.Value type, allowing providers to traverse and mutate a tftypes.Value, respectively. (#60)
tftypes.Value
s now have aType
method, exposing theirtftypes.Type
. (#58)
ENHANCEMENTS:
- A number of methods in
tftypes
are benefitting from a better error message fortftypes.AttributePathError
s, which are returned in various places, and will now surface the path associated with the error as part of the error message. (#68) - Added Equal method to tftypes.Type implementations, allowing them to be compared using github.com/google/go-cmp. (#74)
- Added a Copy method to tftypes.Value, returning a clone of the tftypes.Value such that modifying the clone is guaranteed to not modify the original. (#60)
- Added a String method to tftypes.AttributePath to return a string representation of the tftypes.AttributePath. (#60)
- Added a String method to tftypes.Value, returning a string representation of the tftypes.Value. (#60)
- Added a
tftypes.ValidateValue
function that returns an error if the combination of thetftypes.Type
and Go type passed when panic when passed totftypes.NewValue
. (#67) - Added an Equal method to tftypes.AttributePath to compares two tftypes.AttributePaths. (#60)
- Added an Equal method to tftypes.Value to compare two tftypes.Values. (#60)
- Added support for OptionalAttributes to tftypes.Objects, allowing for objects with attributes that can be set or can be omitted. See https://www.terraform.io/docs/language/expressions/type-constraints.html#experimental-optional-object-type-attributes for more information on optional attributes in objects. (#74)
- Added support for
uint
,uint8
,uint16
,uint32
,uint64
,int
,int8
,int16
,int32
,int64
, andfloat64
conversions when creating atftypes.Number
withtftypes.NewValue
. These were mistakenly omitted previously. (#67) - Added support for version 6 of the Terraform protocol, in a new tfprotov6 package. (#71)
- Updated the String method of all tftypes.Type implementations to include any element or attribute types in the string as well. (#60)
tftypes.AttributePathError
is now exported. Provider developers can useerrors.Is
anderrors.As
to check fortftypes.AttributePathError
s,errors.Unwrap
to get to the underlying error, and thePath
property on atftypes.AttributePathError
to access thetftypes.AttributePath
the error is associated with.tftypes.AttributePath.NewError
andtftypes.AttributePath.NewErrorf
are still the supported ways to create atftypes.AttributePathError
. (#68)
BUG FIXES:
- Fixed a bug in
tftypes.Value.IsFullyKnown
that would cause a panic when callingIsFullyKnown
ontftypes.Value
with atftypes.Type
of Map, Object, List, Set, or Tuple if thetftypes.Value
was null. (#69) - Fixed a bug where
*uint8
,*uint16
, and*uint32
would be coerced toint64
s as part of their conversion intftypes.NewValue
. This may have had no impact, as all those types can be represented in anint64
, but to be sure our conversion is accurate, the conversion was fixed to convert them to auint64
instead. (#67)