-
Notifications
You must be signed in to change notification settings - Fork 105
Use proto v5 mux server #215
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
Conversation
af144f7
to
9831ce8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, minor nit on the variable naming.
provider/factory.go
Outdated
// ProtoV5ProviderServerFactory returns a muxed terraform-plugin-go protocol v5 provider factory function. | ||
// The primary (Plugin SDK) provider server is also returned (useful for testing). | ||
func ProtoV5ProviderServerFactory(ctx context.Context, version string) (func() tfprotov5.ProviderServer, *schema.Provider, error) { | ||
primary := New(version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
primary
doesn't seem like the right name moving forward. Once we have a second provider based on the plugin framework then this would at best be secondary
.
Perhaps something like sdk2Provider
or something similar instead?
"github.com./hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
var Providers map[string]func() (*schema.Provider, error) | ||
var Providers map[string]func() (tfprotov5.ProviderServer, error) | ||
var Provider *schema.Provider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is almost always just used to grab an Elasticsearch client and should be removed IMO. Calling it out here since it removes the need to return the primaryProvider
from the server factory.
provider/factory.go
Outdated
return nil, nil, err | ||
} | ||
|
||
return muxServer.ProviderServer, primary, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, returning the primary
provider makes sense right now, but would start to become more confusing once the migration was actually underway.
Happy to ignore this one for now, and remove the acctest.Provider
variable in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true! Let me make another PR to remove the acctest.Provider
!
#214
This PR adds mux server in reference to aws provider.
https://github.com./hashicorp/terraform-provider-aws/blob/main/internal/provider/factory.go
With this change, we'll be able to use terraform-plugin-framework's provider while keeping existing provider like below.
https://github.com./hashicorp/terraform-provider-aws/blob/d82c79b1e39200aeee5f7928f015af00cfcc633f/internal/provider/factory.go#L23-L26C3
This change won't affect to the users of the provider.