hashicorp / hashicorp/terraform-plugin-framework
New SDK breaks centralized resource schemas
- Dominant language
- Go
- Stars
- 384
- Forks
- 107
- Avg merge
- 3m
- Merged PRs (30d)
- 1
Description
### Module version
0.17.0
### Use-cases
My Terraform provider offers most resources both as a data source and resource. Before this version, I could easily have one place these schemas were in code, to ensure they are both consistent and up to date.
With this new version it seems I have to pretty much duplicate all that code (quite literally, because 99% of the difference is the package the schema comes from)
An example of my use-case can be found here: https://github.com/Doridian/terraform-provider-hexonet/blob/a965c1984e9ef5264f09a97ffd50fd785dbdb24d/hexonet/shared_domain.go#L24
My current attempt can be seen here: https://github.com/Doridian/terraform-provider-hexonet/blob/fix-for-new-sdk/hexonet/shared_domain.go#L30
This of course does not work as data sources cannot accept this type in their schema at all.
### Attempted Solutions
- Tried using common base type, which is internal and therefor unusable (fwschema)
- Duplicated code, which is ugly
### Proposal
Allow some way to create one schema that can be applied to both resources and data sources
Contributor guide
Assessment
This issue has not been assessed yet.