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

tfprotov5+tfprotov6: Initial provider defined functions implementation #351

Merged
merged 5 commits into from
Dec 14, 2023

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Dec 11, 2023

Reference: hashicorp/terraform#34383
Reference: #353

The next version of the plugin protocol (5.5/6.5) includes support for provider defined functions. This change introduces the initial implementation of that support including:

  • Updated Protocol Buffers definitions
  • Re-generated Protocol Buffers Go code
  • Initial implementations of tfprotov5 and tfprotov6 package abstractions and wiring between those abstractions and the Protocol Buffers generated Go code
  • Initial implementations of tfprotov5/tf5server and tfprotov6/tf6server for the new GetFunctions and CallFunction RPCs

This temporarily will not require ProviderServer implementations to include FunctionServer implementation, however that change will occur in a subsequent release.

Reference: hashicorp/terraform#34383

The next version of the plugin protocol (5.5/6.5) includes support for provider defined functions. This change introduces the initial implementation of that support including:

- Updated Protocol Buffers definitions
- Re-generated Protocol Buffers Go code
- Initial implementations of `tfprotov5` and `tfprotov6` package abstractions and wiring between those abstractions and the Protocol Buffers generated Go code
- Initial implementations of `tfprotov5/tf5server` and `tfprotov6/tf6server` for the new `GetFunctions` and `CallFunction` RPCs

Similar to the last set of protocol RPC changes, `ProviderServer` implementations must implement the new RPCs by either including function support or always returning an error. The HashiCorp-maintained provider development SDKs will receive updates to match this change.
@bflad bflad added enhancement New feature or request breaking-change This will impact or improve our compatibility posture labels Dec 11, 2023
@bflad bflad added this to the v0.20.0 milestone Dec 11, 2023
@bflad bflad requested a review from a team as a code owner December 11, 2023 17:31
bflad added a commit to hashicorp/terraform-plugin-framework that referenced this pull request Dec 11, 2023
Reference: hashicorp/terraform-plugin-go#351

The next versions of the plugin protocol (5.5/6.5) include support for provider defined functions. This change includes initial implementation of that support including:

- Temporarily pointing at terraform-plugin-go with provider function support (will be pointed at final terraform-plugin-go release before merge)
- New `function` package with all exposed Go types for provider developers to implement provider functions
- New `diag` package support for diagnostics with optional function argument information
- Implementation of new `GetFunctions` and `CallFunction` RPCs in the internal framework server, protocol 5/6 servers, and data handling between all layers
- Initial website documentation

This functionality may be released as experimental without compatibility promises until the protocol and Terraform's handling of provider functions is finalized. In that situation, all Go and website documentation will include additional callouts about the experimental nature of the functionality.
bflad added a commit to hashicorp/terraform-plugin-mux that referenced this pull request Dec 11, 2023
Reference: hashicorp/terraform-plugin-go#351

The next versions of the plugin protocol (5.6/6.5) include support for provider defined functions. This change inlcudes initial implementation of that support including:

- Temporarily pointing at terraform-plugin-go with provider function support (will be pointed at final terraform-plugin-go release before merge)
- Updates to all provider server packages for new `GetFunctions` and `CallFunction` RPCs
bflad added a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Dec 11, 2023
Reference: hashicorp/terraform-plugin-go#351
Reference: https://developer.hashicorp.com/terraform/plugin/framework/migrating

The next versions of the plugin protocol (5.5/6.5) include support for provider defined functions. The terraform-plugin-sdk Go module will not be receiving this feature, however this Go module must be updated to handle the new RPCs with errors.

Provider developers can still implement provider defined functions in their terraform-plugin-sdk based providers by following the framework migration documentation to introduce terraform-plugin-mux, which then will enable terraform-plugin-framework based provider function implementations.
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.

LGTM 🚀

@bflad
Copy link
Contributor Author

bflad commented Dec 12, 2023

FYI as I mentioned earlier today, I'm going to try to spread the ProviderServer change over two releases: an initial "optional" interface that servers can pick up to remove the "breaking change" here, then later on, remove that optional interface and make it required as part of the ProviderServer interface.

@bflad bflad removed the breaking-change This will impact or improve our compatibility posture label Dec 12, 2023
@bflad
Copy link
Contributor Author

bflad commented Dec 12, 2023

@bendbennett here's what I did if you want to check it: fb1d856

Copy link
Member

@austinvalle austinvalle left a comment

Choose a reason for hiding this comment

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

LGTM 🚀 🚀

@bflad bflad merged commit 4179bf0 into main Dec 14, 2023
61 checks passed
@bflad bflad deleted the functions branch December 14, 2023 15:00
bflad added a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Dec 14, 2023
Reference: hashicorp/terraform-plugin-go#351
Reference: https://developer.hashicorp.com/terraform/plugin/framework/migrating

The next versions of the plugin protocol (5.5/6.5) include support for provider defined functions. The terraform-plugin-sdk Go module will not be receiving this feature, however this Go module must be updated to handle the new RPCs with errors.

Provider developers can still implement provider defined functions in their terraform-plugin-sdk based providers by following the framework migration documentation to introduce terraform-plugin-mux, which then will enable terraform-plugin-framework based provider function implementations.
bflad added a commit to hashicorp/terraform-plugin-mux that referenced this pull request Dec 14, 2023
Reference: hashicorp/terraform-plugin-go#351

The next versions of the plugin protocol (5.5/6.5) include support for provider defined functions. This change includes initial implementation of that support including:

- Temporarily pointing at terraform-plugin-go with provider function support (will be pointed at final terraform-plugin-go release before merge)
- Updates to all provider server packages for new `GetFunctions` and `CallFunction` RPCs
bflad added a commit to hashicorp/terraform-plugin-framework that referenced this pull request Dec 19, 2023
Reference: hashicorp/terraform-plugin-go#351

The next versions of the plugin protocol (5.5/6.5) include support for provider defined functions. This change includes initial implementation of that support including:

- Temporarily pointing at terraform-plugin-go with provider function support (will be pointed at final terraform-plugin-go release before merge)
- New `function` package with all exposed Go types for provider developers to implement provider functions
- New `diag` package support for diagnostics with optional function argument information
- Implementation of new `GetFunctions` and `CallFunction` RPCs in the internal framework server, protocol 5/6 servers, and data handling between all layers
- Initial website documentation

This functionality will be released as technical preview without compatibility promises until Terraform 1.8 is generally available. Go and website documentation include additional callouts about the compatibility of this functionality.

Co-authored-by: Austin Valle <austinvalle@gmail.com>
bflad added a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Jan 29, 2024
Reference: hashicorp/terraform-plugin-go#351
Reference: https://developer.hashicorp.com/terraform/plugin/framework/migrating

The next versions of the plugin protocol (5.5/6.5) include support for moving resource state across resource types. The terraform-plugin-sdk Go module will not be receiving this feature, however this Go module must be updated to handle the new RPC with errors.

Provider developers can implement move resource state in their terraform-plugin-sdk based providers by following the framework migration documentation to introduce terraform-plugin-mux and migrating the resource type to terraform-plugin-framework.
bflad added a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Jan 29, 2024
Reference: hashicorp/terraform-plugin-go#351
Reference: https://developer.hashicorp.com/terraform/plugin/framework/migrating

The next versions of the plugin protocol (5.5/6.5) include support for moving resource state across resource types. The terraform-plugin-sdk Go module will not be receiving this feature, however this Go module must be updated to handle the new RPC with errors.

Provider developers can implement move resource state in their terraform-plugin-sdk based providers by following the framework migration documentation to introduce terraform-plugin-mux and migrating the resource type to terraform-plugin-framework.
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 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
Development

Successfully merging this pull request may close these issues.

3 participants