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

Introduce Protocol Server Capability for Optional GetProviderSchema RPC #310

Closed
bflad opened this issue Jul 7, 2023 · 1 comment · Fixed by #311
Closed

Introduce Protocol Server Capability for Optional GetProviderSchema RPC #310

bflad opened this issue Jul 7, 2023 · 1 comment · Fixed by #311
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@bflad
Copy link
Contributor

bflad commented Jul 7, 2023

terraform-plugin-go version

v0.18.0

Use cases

Terraform core is working on optimizing their overall memory utilization by supporting the ability to cache provider schemas per-type, rather than per-instance. This should cause a statistically significant drop in maximum resident size in Terraform environments running configurations with multiple provider aliases for larger providers, such as hashicorp/aws. The challenge is that not all provider implementations support all RPC operations without the historically upfront GetProviderSchema RPC, such as older versions of terraform-plugin-framework, which used the GetProviderSchema RPC to cache supported resource types for other RPCs.

Proposal

Update the plugin protocol to 5.4 and 6.4 with a new server capability to signal that the GetProviderSchema RPC is optional/skippable. Initial testing shows that terraform-plugin-sdk/[email protected] and [email protected] should be able to enable this capability once its exposed by this Go module. In terraform-plugin-mux, it should be able to front each existing RPC with a logic to call GetProviderSchema first if necessary for the underlying provider server.

References

@bflad bflad added the enhancement New feature or request label Jul 7, 2023
@bflad bflad self-assigned this Jul 7, 2023
@bflad bflad added this to the v0.19.0 milestone Aug 25, 2023
@bflad bflad closed this as completed in #311 Sep 6, 2023
bflad added a commit that referenced this issue Sep 6, 2023
…data RPC and GetProviderSchemaOptional server capability (#311)

Reference: #310

Protocol upgrades that impose new RPCs will either require:

- The `tfprotov5.ProviderServer`/`tfprotov6.ProviderServer` interface to require a new method
- Or, new "optional" interfaces be implemented (let's make up `ProviderServerWithGetMetadata` in this case)

terraform-plugin-go is a low level abstraction which is designed to _directly implement_ the protocol rather than introduce its own abstractions. Most provider developers will directly interface with higher level Go modules, such as terraform-plugin-sdk and terraform-plugin-framework. Except for advanced provider development using this Go module directly, this type of low level "breaking" change will be hidden by also upgrading those Go modules at the same time:

- hashicorp/terraform-plugin-sdk#1235
- hashicorp/terraform-plugin-framework#829
- hashicorp/terraform-plugin-mux#186

Therefore the change is implemented on the existing interface.
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 May 23, 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
1 participant