Skip to content

Commit

Permalink
fix: Fixes timeout and removes deletion logic on update failure for m…
Browse files Browse the repository at this point in the history
…ongodbatlas_search_index resource (#1950)
  • Loading branch information
maastha committed Feb 16, 2024
1 parent 95098f6 commit cee70ec
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/service/searchindex/resource_search_index.go
Expand Up @@ -263,7 +263,7 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag.
}

if d.Get("wait_for_index_build_completion").(bool) {
timeout := d.Timeout(schema.TimeoutCreate)
timeout := d.Timeout(schema.TimeoutUpdate)
stateConf := &retry.StateChangeConf{
Pending: []string{"IN_PROGRESS", "MIGRATING"},
Target: []string{"STEADY"},
Expand All @@ -281,9 +281,7 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag.
"cluster_name": clusterName,
"index_id": indexID,
}))
resourceDelete(ctx, d, meta)
d.SetId("")
return diag.FromErr(fmt.Errorf("error creating index in cluster (%s): %s", clusterName, err))
return diag.FromErr(fmt.Errorf("error updating index in cluster (%s). mongodbatlas_search_index resource was not deleted : %s", clusterName, err))
}
}

Expand Down

0 comments on commit cee70ec

Please sign in to comment.