You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
terraform-plugin-mux, tfprotov5.ProviderServer, and tfprotov6.ProviderServer implementations generally need to check whether a DynamicValue is null. For example, this type of check can be used in PlanResourceChange RPCs to verify whether the intended resource operation is creation or deletion. Currently, DynamicValue only supports an Unmarshal() method, which must be given the expected type information (e.g. from a schema), which may not always be available immediately in implementations.
Attempted solutions
Caching schema information, calling (DynamicValue).Unmarshal(), then checking (tftypes.Value).IsNull().
Proposal
Checking whether a DynamicValue is null can be performed by peeking into the underlying JSON and MessagePack data without fully decoding it. JSON data should have a null value (niljson.Token) and MessagePack data should have a msgpcode.Nil code.
In both tfprotov5 and tfprotov6 packages, add a new IsNull() method to the DynamicValue type.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
terraform-plugin-go version
Use cases
terraform-plugin-mux,
tfprotov5.ProviderServer
, andtfprotov6.ProviderServer
implementations generally need to check whether aDynamicValue
is null. For example, this type of check can be used inPlanResourceChange
RPCs to verify whether the intended resource operation is creation or deletion. Currently,DynamicValue
only supports anUnmarshal()
method, which must be given the expected type information (e.g. from a schema), which may not always be available immediately in implementations.Attempted solutions
Caching schema information, calling
(DynamicValue).Unmarshal()
, then checking(tftypes.Value).IsNull()
.Proposal
Checking whether a
DynamicValue
is null can be performed by peeking into the underlying JSON and MessagePack data without fully decoding it. JSON data should have anull
value (nil
json.Token
) and MessagePack data should have amsgpcode.Nil
code.In both
tfprotov5
andtfprotov6
packages, add a newIsNull()
method to theDynamicValue
type.References
The text was updated successfully, but these errors were encountered: