@@ -17,6 +17,7 @@ import (
17
17
"github.com/hashicorp/terraform-plugin-framework/types"
18
18
"github.com/hashicorp/terraform-plugin-log/tflog"
19
19
"github.com/hashicorp/terraform-provider-aws/internal/actionwait"
20
+ "github.com/hashicorp/terraform-provider-aws/internal/backoff"
20
21
"github.com/hashicorp/terraform-provider-aws/internal/framework"
21
22
fwflex "github.com/hashicorp/terraform-provider-aws/internal/framework/flex"
22
23
fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
@@ -134,7 +135,9 @@ func (a *startBuildAction) Invoke(ctx context.Context, req action.InvokeRequest,
134
135
Message : "Build started, waiting for completion..." ,
135
136
})
136
137
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
138
141
_ , err = actionwait .WaitForStatus (ctx , func (ctx context.Context ) (actionwait.FetchResult [* awstypes.Build ], error ) {
139
142
input := codebuild.BatchGetBuildsInput {Ids : []string {buildID }}
140
143
batch , berr := conn .BatchGetBuilds (ctx , & input )
@@ -148,7 +151,7 @@ func (a *startBuildAction) Invoke(ctx context.Context, req action.InvokeRequest,
148
151
return actionwait.FetchResult [* awstypes.Build ]{Status : actionwait .Status (b .BuildStatus ), Value : & b }, nil
149
152
}, actionwait.Options [* awstypes.Build ]{
150
153
Timeout : timeout ,
151
- Interval : actionwait .FixedInterval ( actionwait . DefaultPollInterval ),
154
+ Interval : actionwait .WithBackoffDelay ( backoff . DefaultSDKv2HelperRetryCompatibleDelay () ),
152
155
ProgressInterval : 2 * time .Minute ,
153
156
SuccessStates : []actionwait.Status {actionwait .Status (awstypes .StatusTypeSucceeded )},
154
157
TransitionalStates : []actionwait.Status {
0 commit comments