-
Notifications
You must be signed in to change notification settings - Fork 137
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
manage admin user for mongodb + use ValidateDiagFunc #609
Conversation
return func(v any, p cty.Path) (diags diag.Diagnostics) { | ||
err := ValidateStringEnum(v.(string), enum) | ||
if err != nil { | ||
diags = append(diags, diag.Diagnostic{ |
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.
note: you could just use diags.AddError()
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.
"terraform-plugin-framework/diag" has it not "terraform-plugin-sdk/v2/diag"
ovh/types_cloud_project_database.go
Outdated
diags = append(diags, diag.Diagnostic{ | ||
Severity: diag.Error, | ||
Summary: "Missing authentication database", | ||
Detail: fmt.Sprintf("value %s do not have authentication database", value), |
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.
Detail: fmt.Sprintf("value %s do not have authentication database", value), | |
Detail: fmt.Sprintf("value %s does not have authentication database", value), |
if err := config.OVHClient.GetWithContext(ctx, listEndpoint, &listRes); err != nil { | ||
return diag.Errorf("Error calling GET %s:\n\t %q", listEndpoint, err) | ||
} | ||
|
||
name := d.Get("name").(string) | ||
if name == "admin" { |
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.
can you really get there considering this line: https://github.com/ovh/terraform-provider-ovh/pull/609/files#diff-914dfbdacc3d33ba986c5cc7c2ec9931d84789eb769aec8102c606e0a82d07c5R31 ?
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.
Yes because the special case for user admin in ovh/resource_cloud_project_database_mongodb_user.go
will call ovh/data_cloud_project_database_mongodb_user.go:dataSourceCloudProjectDatabaseMongodbUserRead()
with name = "admin"
|
||
* `name` - (Required, Forces new resource) Name of the user. | ||
|
||
* `name` - (Required, Forces new resource) Name of the user. A user named "admin" is map with already created admin@admin user instead of create a new user. |
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.
* `name` - (Required, Forces new resource) Name of the user. A user named "admin" is map with already created admin@admin user instead of create a new user. | |
* `name` - (Required, Forces new resource) Name of the user. A user named "admin" is mapped with already created admin@admin user instead of creating a new user. |
|
||
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is map with already created admin user instead of create a new user. | ||
|
||
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is map with already created admin user instead of creating a new user. |
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.
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is map with already created admin user instead of creating a new user. | |
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is mapped with already created admin user instead of creating a new user. |
|
||
* `name` - (Required, Forces new resource) Username affected by this acl. A user named "avnadmin" is map with already created admin user and reset his password instead of create a new user. | ||
|
||
* `name` - (Required, Forces new resource) Username affected by this acl. A user named "avnadmin" is map with already created admin user and reset his password instead of creating a new user. |
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.
* `name` - (Required, Forces new resource) Username affected by this acl. A user named "avnadmin" is map with already created admin user and reset his password instead of creating a new user. | |
* `name` - (Required, Forces new resource) Username affected by this acl. A user named "avnadmin" is mapped with already created admin user and reset his password instead of creating a new user. |
|
||
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is map with already created admin user and reset his password instead of create a new user. | ||
|
||
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is map with already created admin user and reset his password instead of creating a new user. |
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.
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is map with already created admin user and reset his password instead of creating a new user. | |
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is mapped with already created admin user and reset his password instead of creating a new user. |
|
||
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is map with already created admin user and reset his password instead of create a new user. The "Grafana" engine only allows the "avnadmin" mapping. | ||
|
||
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is map with already created admin user and reset his password instead of creating a new user. The "Grafana" engine only allows the "avnadmin" mapping. |
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.
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is map with already created admin user and reset his password instead of creating a new user. The "Grafana" engine only allows the "avnadmin" mapping. | |
* `name` - (Required, Forces new resource) Name of the user. A user named "avnadmin" is mapped with already created admin user and reset his password instead of creating a new user. The "Grafana" engine only allows the "avnadmin" mapping. |
Description
Manage mongodb admin user like avnadmin user for other engines
Related #588 (issue)
Type of change
Please delete options that are not relevant.