terraform-plugin-framework
terraform-plugin-framework copied to clipboard
Add docs/example for (de)serialization of framework types, especially collections
Module version
v1.10.0 currently referenced by the docs
Use-cases
I'm implementing an attribute with a complex type (list of nested objects). The docs [1][2] show how to define the schema, but only have cursory examples for converting to/from framework types to my own (backend) type hierarchy. I found some forum discussion and other provider code (see below) to implement the conversion myself, but an example in the framework docs itself really is missing in my opinion.
[1] https://developer.hashicorp.com/terraform/plugin/framework/handling-data/attributes/list-nested [2] https://developer.hashicorp.com/terraform/plugin/framework/handling-data/attributes/object
Attempted Solutions
Helpful links I found:
- https://github.com/argoproj-labs/terraform-provider-argocd/blob/cced478/internal/provider/model_application.go#L289
- https://discuss.hashicorp.com/t/defining-tschema-setnestedattribute-in-resource-model/54955/2
- #962
some other providers doing similar conversions:
- https://github.com/hetznercloud/terraform-provider-hcloud/blob/74d822aa/internal/datacenter/data_source.go#L323
- https://github.com/unasra/terraform-provider-bloxone/blob/bbf3d52/internal/utils/utils.go#L30
- https://github.com/bpg/terraform-provider-proxmox/blob/f116127/fwprovider/nodes/apt/models.go#L187
- https://github.com/DataDog/terraform-provider-datadog/blob/40503c7/datadog/fwprovider/data_source_datadog_hosts.go#L212
- https://github.com/NaverCloudPlatform/terraform-provider-ncloud/blob/85c86fe/internal/service/hadoop/hadoop.go#L944-L981
Proposal
References
Related:
- #258