Skip to content

Commit 534f2de

Browse files
committed
feat(mongodb): add warning when user_name change
1 parent 8891670 commit 534f2de

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

internal/services/mongodb/instance.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func ResourceInstance() *schema.Resource {
6565
"user_name": {
6666
Type: schema.TypeString,
6767
Optional: true,
68-
ForceNew: true,
6968
Description: "Name of the user created when the cluster is created",
7069
ConflictsWith: []string{
7170
"snapshot_id",
@@ -365,6 +364,18 @@ func ResourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, m inter
365364
InstanceID: ID,
366365
}
367366

367+
var diags diag.Diagnostics
368+
369+
if d.HasChange("user_name") {
370+
diags = append(diags, diag.Diagnostic{
371+
Severity: diag.Warning,
372+
Summary: "Change in 'user_name' detected",
373+
Detail: "[WARN] The 'user_name' field was changed, but this functionality is not supported yet. " +
374+
"As a result, no changes were applied to the instance. " +
375+
"Please be aware that changing the 'user_name' will not modify the instance at this time.",
376+
})
377+
}
378+
368379
if d.HasChange("password") {
369380
password := d.Get("password").(string)
370381
updateUserRequest.Password = &password
@@ -382,8 +393,7 @@ func ResourceInstanceUpdate(ctx context.Context, d *schema.ResourceData, m inter
382393
if err != nil {
383394
return diag.FromErr(err)
384395
}
385-
386-
return ResourceInstanceRead(ctx, d, m)
396+
return append(diags, ResourceInstanceRead(ctx, d, m)...)
387397
}
388398

389399
func ResourceInstanceDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {

0 commit comments

Comments
 (0)