@@ -116,6 +116,16 @@ func (api *API) requestVpcGcpPeeringWithRetry(ctx context.Context, path string,
116116 return api .requestVpcGcpPeeringWithRetry (ctx , path , params , waitOnStatus , attempt , sleep ,
117117 timeout )
118118 }
119+ case 423 :
120+ tflog .Debug (ctx , fmt .Sprintf ("resource is locked, will try again, attempt=%d " , attempt ))
121+ attempt ++
122+ time .Sleep (time .Duration (sleep ) * time .Second )
123+ return api .requestVpcGcpPeeringWithRetry (ctx , path , params , waitOnStatus , attempt , sleep , timeout )
124+ case 503 :
125+ tflog .Debug (ctx , fmt .Sprintf ("service unavailable, will try again, attempt=%d " , attempt ))
126+ attempt ++
127+ time .Sleep (time .Duration (sleep ) * time .Second )
128+ return api .requestVpcGcpPeeringWithRetry (ctx , path , params , waitOnStatus , attempt , sleep , timeout )
119129 }
120130 return attempt , nil , fmt .Errorf ("failed to request VPC peering, status=%d message=%s " ,
121131 response .StatusCode , failed )
@@ -159,6 +169,16 @@ func (api *API) readVpcGcpPeeringWithRetry(ctx context.Context, path string, att
159169 time .Sleep (time .Duration (sleep ) * time .Second )
160170 return api .readVpcGcpPeeringWithRetry (ctx , path , attempt , sleep , timeout )
161171 }
172+ case 423 :
173+ tflog .Debug (ctx , fmt .Sprintf ("resource is locked, will try again, attempt=%d " , attempt ))
174+ attempt ++
175+ time .Sleep (time .Duration (sleep ) * time .Second )
176+ return api .readVpcGcpPeeringWithRetry (ctx , path , attempt , sleep , timeout )
177+ case 503 :
178+ tflog .Debug (ctx , fmt .Sprintf ("service unavailable, will try again, attempt=%d " , attempt ))
179+ attempt ++
180+ time .Sleep (time .Duration (sleep ) * time .Second )
181+ return api .readVpcGcpPeeringWithRetry (ctx , path , attempt , sleep , timeout )
162182 }
163183 return attempt , nil , fmt .Errorf ("failed to read VPC peering, status=%d message=%s " ,
164184 response .StatusCode , failed )
@@ -210,6 +230,16 @@ func (api *API) removeVpcGcpPeeringWithRetry(ctx context.Context, path string, a
210230 time .Sleep (time .Duration (sleep ) * time .Second )
211231 return api .removeVpcGcpPeeringWithRetry (ctx , path , attempt , sleep , timeout )
212232 }
233+ case 423 :
234+ tflog .Debug (ctx , fmt .Sprintf ("resource is locked, will try again, attempt=%d " , attempt ))
235+ attempt ++
236+ time .Sleep (time .Duration (sleep ) * time .Second )
237+ return api .removeVpcGcpPeeringWithRetry (ctx , path , attempt , sleep , timeout )
238+ case 503 :
239+ tflog .Debug (ctx , fmt .Sprintf ("service unavailable, will try again, attempt=%d " , attempt ))
240+ attempt ++
241+ time .Sleep (time .Duration (sleep ) * time .Second )
242+ return api .removeVpcGcpPeeringWithRetry (ctx , path , attempt , sleep , timeout )
213243 }
214244 return fmt .Errorf ("failed to remove VPC peering, status=%d message=%s" , response .StatusCode , failed )
215245}
@@ -250,6 +280,16 @@ func (api *API) readVpcGcpInfoWithRetry(ctx context.Context, path string, attemp
250280 time .Sleep (time .Duration (sleep ) * time .Second )
251281 return api .readVpcGcpInfoWithRetry (ctx , path , attempt , sleep , timeout )
252282 }
283+ case 423 :
284+ tflog .Debug (ctx , fmt .Sprintf ("resource is locked, will try again, attempt=%d " , attempt ))
285+ attempt ++
286+ time .Sleep (time .Duration (sleep ) * time .Second )
287+ return api .readVpcGcpInfoWithRetry (ctx , path , attempt , sleep , timeout )
288+ case 503 :
289+ tflog .Debug (ctx , fmt .Sprintf ("service unavailable, will try again, attempt=%d " , attempt ))
290+ attempt ++
291+ time .Sleep (time .Duration (sleep ) * time .Second )
292+ return api .readVpcGcpInfoWithRetry (ctx , path , attempt , sleep , timeout )
253293 }
254294 return nil , fmt .Errorf ("failed to read VPC info, status=%d message=%s " ,
255295 response .StatusCode , failed )
0 commit comments