hashicorp / hashicorp/terraform-plugin-framework
Support dynamic types in collections
- Dominant language
- Go
- Stars
- 384
- Forks
- 107
- Avg merge
- 3m
- Merged PRs (30d)
- 1
Description
### Module version
```
github.com/hashicorp/terraform-plugin-framework v1.7.0
```
### Use-cases
I'm trying out the new dynamic types in version 1.7 and encountered a limitation while trying to use a dynamic type within a collection. My guess is that is the same underlying restriction I previously reported in #147 and therefore (almost?) impossible to fix. However I'm not that deep into the internals of terraform, thus I wanted to ask/clarify whether dynamic types in collections will ever be supported or not.
### Attempted Solutions
I simply used my custom dynamic type within a collection and got the following error:
```
monitoring_coreos_com_pod_monitor_v1_manifest_test.go:29: Schema validation diagnostics: [{detail:When validating the schema, an implementation issue was found. This is always an issue with the provider and should be reported to the provider developers.
"spec.pod_metrics_endpoints" is an attribute that contains a collection type with a nested dynamic type.
Dynamic types inside of collections are not currently supported in terraform-plugin-framework. If underlying dynamic values are required, replace the "spec.pod_metrics_endpoints" attribute definition with DynamicAttribute instead. summary:Invalid Schema Implementation}]
```
The suggestion to change the type of the collection itself to a DynamicAttribute might work, however I fear that this will require lots of attributes to be changed to dynamics and therefore a heavy loss on static type information.
### Proposal
Well if it is at all possible, I'd love to have support for dynamic types in collections. If that's not possible, my immediate use case (an IntOrString type) will be solved the same way I do it today: Declare the type as string and tell users that this is something they have to keep in mind while using the provider.
### References
#147
https://github.com/metio/terraform-provider-k8s/pull/119
Contributor guide
Assessment
This issue has not been assessed yet.