@@ -1264,6 +1264,10 @@ func (me *ClbService) DescribeTargetGroupInstances(ctx context.Context, filters
12641264}
12651265
12661266func (me * ClbService ) AssociateTargetGroups (ctx context.Context , listenerId , clbId , targetGroupId , locationId string ) (errRet error ) {
1267+
1268+ var (
1269+ logId = getLogId (ctx )
1270+ )
12671271 request := clb .NewAssociateTargetGroupsRequest ()
12681272 association := clb.TargetGroupAssociation {
12691273 LoadBalancerId : & clbId ,
@@ -1277,9 +1281,17 @@ func (me *ClbService) AssociateTargetGroups(ctx context.Context, listenerId, clb
12771281
12781282 err := resource .Retry (writeRetryTimeout , func () * resource.RetryError {
12791283 ratelimit .Check (request .GetAction ())
1280- _ , err := me .client .UseClbClient ().AssociateTargetGroups (request )
1284+ response , err := me .client .UseClbClient ().AssociateTargetGroups (request )
12811285 if err != nil {
12821286 return retryError (err , InternalError )
1287+ } else {
1288+ log .Printf ("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n " ,
1289+ logId , request .GetAction (), request .ToJsonString (), response .ToJsonString ())
1290+ requestId := * response .Response .RequestId
1291+ retryErr := waitForTaskFinish (requestId , me .client .UseClbClient ())
1292+ if retryErr != nil {
1293+ return resource .NonRetryableError (errors .WithStack (retryErr ))
1294+ }
12831295 }
12841296 return nil
12851297 })
@@ -1299,9 +1311,6 @@ func (me *ClbService) DescribeAssociateTargetGroups(ctx context.Context, ids []s
12991311 if err != nil {
13001312 return retryError (err , InternalError )
13011313 }
1302- if targetInfos == nil || len (targetInfos [0 ].AssociatedRule ) == 0 {
1303- return resource .RetryableError (fmt .Errorf ("response is nil" ))
1304- }
13051314 return nil
13061315 })
13071316 if err != nil {
0 commit comments