Skip to content

Commit

Permalink
fix: Fixes mongodbatlas_search_index create and update when attribu…
Browse files Browse the repository at this point in the history
…te `wait_for_index_build_completion` is used (#2887)

* includes READY in target states for mongodbatlas_search_index

* changelog

* TestAccSearchIndex_withWaitForIndexBuildCompletion

* add PENDING state

* add BUILDING state

* Revert "TestAccSearchIndex_withWaitForIndexBuildCompletion"

This reverts commit 5b0fbe3.
lantoli authored Dec 13, 2024
1 parent 391a3f8 commit 1bf2a1c
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/2887.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/mongodbatlas_search_index: Fixes resource create and update when `wait_for_index_build_completion` attribute is used
```
8 changes: 4 additions & 4 deletions internal/service/searchindex/resource_search_index.go
Original file line number Diff line number Diff line change
@@ -275,8 +275,8 @@ func resourceUpdate(ctx context.Context, d *schema.ResourceData, meta any) diag.
if d.Get("wait_for_index_build_completion").(bool) {
timeout := d.Timeout(schema.TimeoutUpdate)
stateConf := &retry.StateChangeConf{
Pending: []string{"IN_PROGRESS", "MIGRATING"},
Target: []string{"STEADY"},
Pending: []string{"PENDING", "BUILDING", "IN_PROGRESS", "MIGRATING"},
Target: []string{"READY", "STEADY"},
Refresh: resourceSearchIndexRefreshFunc(ctx, clusterName, projectID, indexID, connV2),
Timeout: timeout,
MinTimeout: 1 * time.Minute,
@@ -449,8 +449,8 @@ func resourceCreate(ctx context.Context, d *schema.ResourceData, meta any) diag.
if d.Get("wait_for_index_build_completion").(bool) {
timeout := d.Timeout(schema.TimeoutCreate)
stateConf := &retry.StateChangeConf{
Pending: []string{"IN_PROGRESS", "MIGRATING"},
Target: []string{"STEADY"},
Pending: []string{"PENDING", "BUILDING", "IN_PROGRESS", "MIGRATING"},
Target: []string{"READY", "STEADY"},
Refresh: resourceSearchIndexRefreshFunc(ctx, clusterName, projectID, indexID, connV2),
Timeout: timeout,
MinTimeout: 1 * time.Minute,

0 comments on commit 1bf2a1c

Please sign in to comment.