hashicorp / terraform-plugin-go

A low-level Go binding for the Terraform protocol for integrations to be built on top of.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tfprotov5+tfprotov6: Add FunctionServer to ProviderServer interface

bflad opened this issue · comments

terraform-plugin-go version

v0.20.0 (not yet released)

Description

The upcoming v0.20.0 release will contain the tfprotov5 and tfprotov6 package FunctionServer interface, which contains the two RPC function handlers for provider defined functions. Rather than immediately requiring all downstream SDK implementations to implement this functionality immediately by requiring FunctionServer as part of ProviderServer, it seems ideal if we can stagger the releases between introducing and supporting the new FunctionServer bits then having a followup release that makes the implementation required with the "breaking change" to match the intended design of this Go module to always require all provider implementations to fully implement the protocol.

For provider developers, this type of terraform-plugin-go change previously surfaced as confusing missing method XXX when updating only some dependencies of terraform-plugin-framework, terraform-plugin-mux, terraform-plugin-sdk, or terraform-plugin-testing where terraform-plugin-go required the additional ProviderServer bits, but with the newer setup there can at least be better chance that particular update issue won't occur for them.

Proposal

In the first release, temporarily check for FunctionServer interface implementation in tfprotov5/tf5server and tfprotov6/tf6server package GetFunctions and CallFunction implementations. If found, pass request downstream. If not found, raise an error diagnostic.

In the second release (part of this issue), add FunctionServer interface in ProviderServer implementation. Remove temporary FunctionServer interface checks and associated error diagnostic.

References