Skip to content

Commit

Permalink
fix: Ensure advanced configuration updates trigger wait for completion
Browse files Browse the repository at this point in the history
  • Loading branch information
EspenAlbert committed Jan 10, 2025
1 parent 19c703f commit 3b31e0b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/service/advancedcluster/resource_advanced_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -943,19 +943,27 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag.

ac := d.Get("advanced_configuration")
if aclist, ok := ac.([]any); ok && len(aclist) > 0 {
advancedConfigChanged := false
params20240530, params := expandProcessArgs(d, aclist[0].(map[string]any), &mongoDBMajorVersion)
if !reflect.DeepEqual(params20240530, admin20240530.ClusterDescriptionProcessArgs{}) {
advancedConfigChanged = true
_, _, err := connV220240530.ClustersApi.UpdateClusterAdvancedConfiguration(ctx, projectID, clusterName, &params20240530).Execute()
if err != nil {
return diag.FromErr(fmt.Errorf(errorConfigUpdate, clusterName, err))
}
}
if !reflect.DeepEqual(params, admin.ClusterDescriptionProcessArgs20240805{}) {
advancedConfigChanged = true
_, _, err := connV2.ClustersApi.UpdateClusterAdvancedConfiguration(ctx, projectID, clusterName, &params).Execute()
if err != nil {
return diag.FromErr(fmt.Errorf(errorConfigUpdate, clusterName, err))
}
}
if advancedConfigChanged {
if err := waitForUpdateToFinish(ctx, connV2, projectID, clusterName, timeout); err != nil {
return diag.FromErr(fmt.Errorf(errorUpdate, clusterName, err))
}
}
}
}

Expand Down

0 comments on commit 3b31e0b

Please sign in to comment.