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

providerserver: Implement native protocol version 5 support #368

Merged
merged 6 commits into from
Jun 13, 2022

Conversation

bflad
Copy link
Member

@bflad bflad commented 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).

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 added the enhancement New feature or request label Jun 9, 2022
@bflad bflad added this to the v0.9.0 milestone Jun 9, 2022
@bflad bflad requested a review from a team as a code owner June 9, 2022 17:39
Copy link
Contributor

@bendbennett bendbennett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to be completely honest, I only skimmed this owing to the size of the PR but it LGTM.

Copy link
Contributor

@detro detro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from a potential typo in a comment, this looks good.

But I admit, is too large to review everything: I take the description as guideline that this does what's supposed to do :)

internal/fromproto5/doc.go Outdated Show resolved Hide resolved
Co-authored-by: Ivan De Marino <ivan.demarino@hashicorp.com>
internal/proto5server/doc.go Outdated Show resolved Hide resolved
internal/toproto5/doc.go Outdated Show resolved Hide resolved
@bflad bflad merged commit dd9ee86 into main Jun 13, 2022
@bflad bflad deleted the bflad-providerserver-protocol-version-5 branch June 13, 2022 16:53
bflad added a commit to hashicorp/terraform-docs-common that referenced this pull request Jun 14, 2022
…ementations

Reference: hashicorp/terraform-plugin-framework#368

terraform-plugin-framework v0.9.0 will natively support Terraform Plugin Protocol version 5, which simplifies implementations which must support Terraform CLI 0.12 or later, or those migrating from terraform-plugin-sdk/v2 to the framework and using terraform-plugin-mux. Other plugin documentation is being separately updated.
bflad added a commit to hashicorp/terraform-docs-common that referenced this pull request Jun 15, 2022
…ementations (#42)

Reference: hashicorp/terraform-plugin-framework#368

terraform-plugin-framework v0.9.0 will natively support Terraform Plugin Protocol version 5, which simplifies implementations which must support Terraform CLI 0.12 or later, or those migrating from terraform-plugin-sdk/v2 to the framework and using terraform-plugin-mux. Other plugin documentation is being separately updated.
bflad added a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Jun 15, 2022
… version 5

Reference: hashicorp/terraform-plugin-framework#368

Provider developers no longer need to use the terraform-plugin-mux `tf6to5server` package when combining sdk/v2 and framework providers with Terraform 0.12 and later compatibility.
bflad added a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Jun 16, 2022
… version 5 (#984)

Reference: hashicorp/terraform-plugin-framework#368

Provider developers no longer need to use the terraform-plugin-mux `tf6to5server` package when combining sdk/v2 and framework providers with Terraform 0.12 and later compatibility.
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, 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 Jul 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants