Skip to content

Commit

Permalink
Adds retry on ConflictException
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavison committed Dec 4, 2024
1 parent e679b3a commit 459a740
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/service/bedrock/inference_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,14 @@ func (r *resourceInferenceProfile) Create(ctx context.Context, req resource.Crea

input.Tags = getTagsIn(ctx)

out, err := conn.CreateInferenceProfile(ctx, &input)
out, err := tfresource.RetryGWhen(ctx, 2*time.Minute, func() (*bedrock.CreateInferenceProfileOutput, error) {
return conn.CreateInferenceProfile(ctx, &input)
}, func(err error) (bool, error) {
if errs.IsA[*awstypes.ConflictException](err) {
return true, err
}
return false, err
})
if err != nil {
resp.Diagnostics.AddError(
create.ProblemStandardMessage(names.Bedrock, create.ErrActionCreating, ResNameInferenceProfile, plan.Name.String(), err),
Expand Down

0 comments on commit 459a740

Please sign in to comment.