-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bug] Reuse and close connections per resource
This commit changes the way we handle connections and clients: - It now creates the connection to the controlplane at provider level and passed down to the resources. - It does the same with the authentication token. - Now, after every method is run, we close the connection created with the dataplane. Previously we were leaving the connection open causing a lot of port usage on every terraform command that the user ran.
- Loading branch information
Showing
17 changed files
with
215 additions
and
417 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2024 Redpanda Data, Inc. | ||
// | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Package config contains the configuration structs to initialize our clients | ||
// and provider. | ||
package config | ||
|
||
import "google.golang.org/grpc" | ||
|
||
// Resource is the config used to pass data and dependencies to resource | ||
// implementations. | ||
type Resource struct { | ||
AuthToken string | ||
ClientID string | ||
ClientSecret string | ||
CloudEnv string | ||
ControlPlaneConnection *grpc.ClientConn | ||
} | ||
|
||
// Datasource is the config used to pass data and dependencies to data source | ||
// implementations. | ||
type Datasource struct { | ||
AuthToken string | ||
ClientID string | ||
ClientSecret string | ||
CloudEnv string | ||
ControlPlaneConnection *grpc.ClientConn | ||
} | ||
|
||
// TODO add cloud provider and region as values to persist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.