tftypes: Consider Additional Errors for (Value).ApplyTerraform5AttributePathStep() #113
Labels
breaking-change
This will impact or improve our compatibility posture
enhancement
New feature or request
terraform-plugin-go version
Use cases
Downstream consumers using
tftypes.WalkAttributePath()
against atftypes.Value
tend to alway receive the sametftypes.ErrInvalidStep
error, regardless of the cause, which may include:WithAttributeName()
on aList
value)The ability to distinguish between these situations means that these consumers can further tailor their intended behaviors, without the need to then determine the underlying cause.
Attempted solutions
After receiving
ErrInvalidStep
, walk backwards in the path (via recursive(AttributePath).WithoutLastStep()
until noErrInvalidStep
is received) to detect a parent value withIsUnknown()
.Proposal
Create two new error values (one for stepping into a null value, one for stepping into an unknown value) and convert this logic to use them:
e.g.
In the error implementation, they should still be appropriately detectable via
errors.Is(tftypes.ErrInvalidStep)
or this enhancement becomes a breaking change.References
The text was updated successfully, but these errors were encountered: