@@ -17,6 +17,7 @@ import (
1717 "github.com/hashicorp/terraform-plugin-framework/types"
1818 "github.com/hashicorp/terraform-plugin-log/tflog"
1919 "github.com/hashicorp/terraform-provider-aws/internal/actionwait"
20+ "github.com/hashicorp/terraform-provider-aws/internal/backoff"
2021 "github.com/hashicorp/terraform-provider-aws/internal/framework"
2122 fwflex "github.com/hashicorp/terraform-provider-aws/internal/framework/flex"
2223 fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
@@ -134,7 +135,9 @@ func (a *startBuildAction) Invoke(ctx context.Context, req action.InvokeRequest,
134135 Message : "Build started, waiting for completion..." ,
135136 })
136137
137- // Poll for build completion using actionwait
138+ // Poll for build completion using actionwait with backoff strategy
139+ // Use backoff since builds can take a long time and status changes less frequently
140+ // as the build progresses - start with frequent polling then back off
138141 _ , err = actionwait .WaitForStatus (ctx , func (ctx context.Context ) (actionwait.FetchResult [* awstypes.Build ], error ) {
139142 input := codebuild.BatchGetBuildsInput {Ids : []string {buildID }}
140143 batch , berr := conn .BatchGetBuilds (ctx , & input )
@@ -148,7 +151,7 @@ func (a *startBuildAction) Invoke(ctx context.Context, req action.InvokeRequest,
148151 return actionwait.FetchResult [* awstypes.Build ]{Status : actionwait .Status (b .BuildStatus ), Value : & b }, nil
149152 }, actionwait.Options [* awstypes.Build ]{
150153 Timeout : timeout ,
151- Interval : actionwait .FixedInterval ( actionwait . DefaultPollInterval ),
154+ Interval : actionwait .WithBackoffDelay ( backoff . DefaultSDKv2HelperRetryCompatibleDelay () ),
152155 ProgressInterval : 2 * time .Minute ,
153156 SuccessStates : []actionwait.Status {actionwait .Status (awstypes .StatusTypeSucceeded )},
154157 TransitionalStates : []actionwait.Status {
0 commit comments