Skip to content

Commit c06b08e

Browse files
authored
fix(iaas): image upload results in timeout (#773)
1 parent 36d263d commit c06b08e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

stackit/internal/services/iaas/image/resource.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88
"os"
99
"strings"
10+
"time"
1011

1112
"github.com/hashicorp/terraform-plugin-framework/attr"
1213
"github.com/hashicorp/terraform-plugin-framework/diag"
@@ -442,7 +443,9 @@ func (r *imageResource) Create(ctx context.Context, req resource.CreateRequest,
442443
}
443444

444445
// Wait for image to become available
445-
waitResp, err := wait.UploadImageWaitHandler(ctx, r.client, projectId, *imageCreateResp.Id).WaitWithContext(ctx)
446+
waiter := wait.UploadImageWaitHandler(ctx, r.client, projectId, *imageCreateResp.Id)
447+
waiter = waiter.SetTimeout(7 * 24 * time.Hour) // Set timeout to one week, to make the timeout useless
448+
waitResp, err := waiter.WaitWithContext(ctx)
446449
if err != nil {
447450
core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating image", fmt.Sprintf("Waiting for image to become available: %v", err))
448451
return

0 commit comments

Comments
 (0)