Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an upgrade path for SDKv2 providers #158

Closed
7 tasks done
paddycarver opened this issue Sep 14, 2021 · 3 comments
Closed
7 tasks done

Provide an upgrade path for SDKv2 providers #158

paddycarver opened this issue Sep 14, 2021 · 3 comments
Labels
epic Meta issues that contain groups of other, related issues for tracking purposes.
Milestone

Comments

@paddycarver
Copy link
Contributor

paddycarver commented Sep 14, 2021

As we build out the framework and it becomes a viable replacement for SDKv2, we need to define the migration path for providers built on SDKv2 to be built on framework, instead. We don't want to make provider devs rewrite their entire provider in one fell swoop. Ideally, people would be able to migrate over one resource at a time. This is going to take some doing, so we can keep practitioner-facing breaking changes in the control of provider developers.

@paddycarver paddycarver added the epic Meta issues that contain groups of other, related issues for tracking purposes. label Sep 14, 2021
@paddycarver
Copy link
Contributor Author

We discussed the possibility of having a protocol 6 -> protocol 5 converter, similar to hashicorp/terraform-plugin-go-contrib#7 but in the opposite direction, that would allow provider developers to build providers with the framework that work on any version of Terraform after 0.12.

To achieve this, we would need to disallow the use of nested attributes in that mode, likely as a panic or error in the conversion function if a nested attribute is returned as part of the schema.

I'm not sure whether I think this is a good idea or not yet, but I'm recording it here for further consideration.

@bflad bflad added this to the v1.0.0 milestone Mar 16, 2022
bflad added a commit that referenced this issue Jun 9, 2022
Reference: #158

This enables provider developers to natively create and serve framework providers on protocol version 5, which is compatible with Terraform CLI 0.12 and later. For provider developers that are using terraform-plugin-mux to migrate from terraform-plugin-sdk to this framework, they can now omit the usage of the `tf6to5server` package by setting the `ServeOpts` type `ProtocolVersion` field to `5`.

Any protocol layer restrictions with the older protocol version 5 are raised as errors from the framework. For example, if `Attributes` is defined in a `tfsdk.Attribute` ("nested attributes"), the `GetProviderSchema` RPC response will include an error diagnostic.

This implementation is essentially a duplication of the `internal/fromproto6`, `internal/proto6server`, and `internal/toproto6` packages with renaming of 6 to 5 and any minor RPC naming differences to match the protocol (e.g. `ValidateDataResourceConfig` -> `ValidateDataSourceConfig`, `ValidateProviderConfig` -> `PrepareProviderConfig`, `ValidateResourceConfig` -> `ValidateResourceTypeConfig`).
bflad added a commit that referenced this issue Jun 13, 2022
Reference: #158

This enables provider developers to natively create and serve framework providers on protocol version 5, which is compatible with Terraform CLI 0.12 and later. For provider developers that are using terraform-plugin-mux to migrate from terraform-plugin-sdk to this framework, they can now omit the usage of the `tf6to5server` package by setting the `ServeOpts` type `ProtocolVersion` field to `5`.

Any protocol layer restrictions with the older protocol version 5 are raised as errors from the framework. For example, if `Attributes` is defined in a `tfsdk.Attribute` ("nested attributes"), the `GetProviderSchema` RPC response will include an error diagnostic.

This implementation is essentially a duplication of the `internal/fromproto6`, `internal/proto6server`, and `internal/toproto6` packages with renaming of 6 to 5 and any minor RPC naming differences to match the protocol (e.g. `ValidateDataResourceConfig` -> `ValidateDataSourceConfig`, `ValidateProviderConfig` -> `PrepareProviderConfig`, `ValidateResourceConfig` -> `ValidateResourceTypeConfig`).
@bflad bflad modified the milestones: v1.0.0, v0.12.0 Sep 23, 2022
@bflad
Copy link
Contributor

bflad commented Sep 23, 2022

The last item, creating a terraform-plugin-sdk migration guide, is started here: https://www.terraform.io/plugin/framework/migrating

Closing!

@bflad bflad closed this as completed Sep 23, 2022
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
epic Meta issues that contain groups of other, related issues for tracking purposes.
Projects
None yet
Development

No branches or pull requests

2 participants