Skip to content

tf6muxserver: Initial implementation#37

Merged
bflad merged 3 commits intomainfrom
bflad-tf6muxserver
Feb 2, 2022
Merged

tf6muxserver: Initial implementation#37
bflad merged 3 commits intomainfrom
bflad-tf6muxserver

Conversation

@bflad
Copy link
Copy Markdown
Contributor

@bflad bflad commented Jan 13, 2022

Closes #19

This new package implements a protocol version 6 compatible mux server. It is implemented similar to the existing protocol version 5 mux server, where validation and schema caching occurs upfront, then most RPCs act as a router.

The main differences between the existing implementation and this new one are as follows:

  • Functionality is bundled into a package below the root package.
  • Naming is simplified and clarified. Previously, the capabilities of the mux server were believed to become much more dynamic, however in practice this never materialized due to the protocol. The mux server serves much more than a "Schema" so it is named "Mux" to prevent confusion.
  • There is no separation between a "Factory" and creating the mux server. There is not currently a benefit to introducing two layers of mux server handling. The main and only necessary entrypoint is a NewMuxServer function.
  • A ProviderServer method is provided to further simplify implementations, rather than needing a wrapping func() tfprotov6.ProviderServer.

Once this package lands, the existing SchemaServer and SchemaServerFactory handling in the root package will be converted into a new tf5muxserver package with a similar API and structure as this one. That breaking change will occur afterwards before the next release.

@bflad bflad added the enhancement New feature or request label Jan 13, 2022
@bflad bflad added this to the v0.5.0 milestone Jan 13, 2022
@bflad bflad requested a review from a team January 13, 2022 21:38
bflad added a commit that referenced this pull request Jan 13, 2022
bflad added a commit that referenced this pull request Jan 18, 2022
…sion 6 implementation

Reference: #19
Reference: #37

Includes new internal tf5testserver package implementation.
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment on lines +42 to +44
- terraform-plugin-framwork: Implements protocol version 6.
- terraform-plugin-sdk: Implements protocol version 5.
- terraform-plugin-go: Implements either protocol version, based on whether the `tf5server` package (protocol version 5) or `tf6server` package (protocol version 6) is being used.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe add a link to each of the repos?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great idea, will add.

Reference: #19

This new package implements a protocol version 6 compatible mux server. It is implemented similar to the existing protocol version 5 mux server, where validation and schema caching occurs upfront, then most RPCs act as a router.

The main differences between the existing implementation and this new one are as follows:

- Functionality is bundled into a package below the root package.
- Naming is simplified and clarified. Previously, the capabilities of the mux server were believed to become much more dynamic, however in practice this never materialized due to the protocol. The mux server serves much more than a "Schema" so it is named "Mux" to prevent confusion.
- There is no separation between a "Factory" and creating the mux server. There is not currently a benefit to introducing two layers of mux server handling. The main and only necessary entrypoint is a `NewMuxServer` function.
- A `ProviderServer` method is provided to further simplify implementations, rather than needing a wrapping `func() tfprotov6.ProviderServer`.

Once this package lands, the existing `SchemaServer` and `SchemaServerFactory` handling in the root package will be converted into a new `tf5muxserver` package with a similar API and structure as this one. That breaking change will occur afterwards before the next release.
@bflad bflad force-pushed the bflad-tf6muxserver branch from 2c44aa2 to 3c500cb Compare January 20, 2022 19:44
bflad and others added 2 commits January 20, 2022 14:44
Co-authored-by: Kit Ewbank <Kit_Ewbank@hotmail.com>
bflad added a commit that referenced this pull request Jan 20, 2022
…sion 6 implementation

Reference: #19
Reference: #37

Includes new internal tf5testserver package implementation.
bflad added a commit that referenced this pull request Jan 20, 2022
Server unit testing is pending testing server implementations from #37 and #39.
Copy link
Copy Markdown
Member

@kmoe kmoe left a comment

Choose a reason for hiding this comment

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

Excellent. Agree with simplifications, and delighted with tests!


if resp.Provider != nil {
if result.providerSchema != nil && !schemaEquals(resp.Provider, result.providerSchema) {
return result, fmt.Errorf("got a different provider schema across servers. Provider schemas must be identical across providers. Diff: %s", schemaDiff(resp.Provider, result.providerSchema))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good simplification - no need for providerSchemaFrom & factory pattern

@bflad bflad merged commit 65ec367 into main Feb 2, 2022
@bflad bflad deleted the bflad-tf6muxserver branch February 2, 2022 17:04
bflad added a commit that referenced this pull request Feb 2, 2022
…sion 6 implementation

Reference: #19
Reference: #37

Includes new internal tf5testserver package implementation.
bflad added a commit that referenced this pull request Feb 2, 2022
…sion 6 implementation (#39)

* Move existing root SchemaServer and SchemaServerFactory implementation to new tf5muxserver package

* Migrate SchemaServer implementation to be similar to new protocol version 6 implementation

Reference: #19
Reference: #37

Includes new internal tf5testserver package implementation.
@github-actions
Copy link
Copy Markdown

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 May 28, 2024
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.

Support protocol version 6

3 participants