hashicorp / terraform-plugin-go

A low-level Go binding for the Terraform protocol for integrations to be built on top of.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tftypes: Surface Protocol Unknown Value Refinements

bflad opened this issue · comments

terraform-plugin-go version

v0.18.0

Use cases

Terraform 1.6 and later supports cty value refinements internally and as part of the MessagePack encoding of the value across the plugin protocol. This is done via MessagePack extension functionality as described in the plugin protocol object wire format documentation. This additional value encoding is safe today for existing implementations because extensions have always been considered an unknown value when decoding.

Example use cases:

  • For values from Terraform, provider developers will be able to use this functionality to perform configuration validation on partially unknown values.
  • For values to Terraform, provider developers will be able to use this functionality to signal partially unknown values, such as signaling that an unknown value will never be null.

Proposal

TBD.

Implementation notes:

  • To prevent breaking existing implementations, a partially unknown value must still be treated as wholly unknown. For example, the tftypes.Value type IsKnown() method should still return false for both wholly unknown and partially unknown values. Consumers will be required to check for partial unknown-ness, if desired, before current unknown checks.
  • MessagePack extension codes outside of 12 should remain treated as wholly unknown to account for other potential future enhancements to the protocol.

References