tfsdk: Migrate schema handling to internal interfaces #438
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reference: #31
Reference: #132
Reference: #223
Reference: #326
Reference: #365
Reference: #389
The main goals of this change are:
datasource
,provider
, andresource
packagestfsdk
package schema implementation with minimal provider developer breaking changes, allowing a deprecation period when the concept-specific schemas are introducedtfsdk
schema functionality to internal packagesThese goals are accomplished by creating new
internal/fwschema
andinternal/fwxschema
packages, which contain interface types that the provider developer facing packages implement. Currently, thetfsdk
package is the only implementation, until the design of those concept-specific schema declarations is fully determined. Those designs may include changes to schema implementation details, which cannot be accomplished in the existingtfsdk
implementation without breaking it and provider developers migrating code to the new packages is a great time to make those types of changes.The internal interface method design here is purposefully similar to the existing
tfsdk
implementations as we cannot name the methods the same as existing fields and to reduce review burden. After thetfsdk
implementations are removed, we can consider tidying up the interface methods to drop theGet
andIs
method name prefixes.There are some minor followup changes that will happen either between or during concept-specific schema implementation work, namely:
tfsdk
package typeTerraformType()
methods forAttributeType().TerraformType()
to reduce implementation work for new schema implementationstfsdk.Schema
to set up sub-tests via(*testing.T).Run()
to against multiple implementationsThese were not included here to reduce the review burden as they are separate details which can be handled later.