Skip to content

Commit

Permalink
Configure provider server.
Browse files Browse the repository at this point in the history
Configuring provider server with a nil configuration request lets
server retrieve already-configured provider's configuration.

Signed-off-by: Cem Mergenci <cmergenci@gmail.com>
  • Loading branch information
mergenci committed Jan 2, 2024
1 parent 02ecafb commit f054c10
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/controller/external_terraform_plugin_framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,20 @@ func (c *TerraformPluginFrameworkConnector) Connect(ctx context.Context, mg xpre
opTracker.SetTfState(s)
}

server := providerserver.NewProtocol5(*c.terraformPluginFrameworkProvider)()
_, err = server.ConfigureProvider(ctx, nil)
if err != nil {
return nil, errors.Wrap(err, "cannot configure provider server")
}

return &terraformPluginFrameworkExternalClient{
ts: ts,
config: c.config,
logger: logger,
metricRecorder: c.metricRecorder,
opTracker: opTracker,
resource: c.config.TerraformPluginFrameworkResource,
server: providerserver.NewProtocol5(*c.terraformPluginFrameworkProvider)(),
server: server,
params: params,
// rawConfig: rawConfig,
}, nil
Expand Down

0 comments on commit f054c10

Please sign in to comment.