Fix PostgresFlex references in MongoDB Flex (#91)

* Fix PostgresFlex references in MongoDB Flex

* Update docs

* Re-generate docs
This commit is contained in:
João Palet 2023-10-17 17:53:45 +02:00 committed by GitHub
parent 9d11098102
commit 3c6748545d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 11 deletions

View file

@ -66,10 +66,10 @@ func (r *userDataSource) Configure(ctx context.Context, req datasource.Configure
var apiClient *mongodbflex.APIClient
var err error
if providerData.PostgresFlexCustomEndpoint != "" {
if providerData.MongoDBFlexCustomEndpoint != "" {
apiClient, err = mongodbflex.NewAPIClient(
config.WithCustomAuth(providerData.RoundTripper),
config.WithEndpoint(providerData.PostgresFlexCustomEndpoint),
config.WithEndpoint(providerData.MongoDBFlexCustomEndpoint),
)
} else {
apiClient, err = mongodbflex.NewAPIClient(
@ -84,16 +84,16 @@ func (r *userDataSource) Configure(ctx context.Context, req datasource.Configure
}
r.client = apiClient
tflog.Info(ctx, "PostgresFlex user client configured")
tflog.Info(ctx, "MongoDB Flex user client configured")
}
// Schema defines the schema for the data source.
func (r *userDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
descriptions := map[string]string{
"main": "PostgresFlex user data source schema. Must have a `region` specified in the provider configuration.",
"main": "MongoDB Flex user data source schema. Must have a `region` specified in the provider configuration.",
"id": "Terraform's internal data source. ID. It is structured as \"`project_id`,`instance_id`,`user_id`\".",
"user_id": "User ID.",
"instance_id": "ID of the PostgresFlex instance.",
"instance_id": "ID of the MongoDB Flex instance.",
"project_id": "STACKIT project ID to which the instance is associated.",
}
@ -181,7 +181,7 @@ func (r *userDataSource) Read(ctx context.Context, req datasource.ReadRequest, r
if resp.Diagnostics.HasError() {
return
}
tflog.Info(ctx, "PostgresFlex user read")
tflog.Info(ctx, "MongoDB Flex user read")
}
func mapDataSourceFields(userResp *mongodbflex.GetUserResponse, model *DataSourceModel) error {

View file

@ -328,10 +328,10 @@ func (r *userResource) ImportState(ctx context.Context, req resource.ImportState
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), idParts[1])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("user_id"), idParts[2])...)
core.LogAndAddWarning(ctx, &resp.Diagnostics,
"Postgresflex user imported with empty password",
"MongoDB Flex user imported with empty password",
"The user password is not imported as it is only available upon creation of a new user. The password field will be empty.",
)
tflog.Info(ctx, "Postgresflex user state imported")
tflog.Info(ctx, "MongoDB Flex user state imported")
}
func mapFieldsCreate(userResp *mongodbflex.CreateUserResponse, model *Model) error {