Need help to register multiple targets to multiple target_groups

I saw an example for one target to one target group. here. But my need is multuple ids ( the target type is ip) to multiple target group

eg target_ids = [ [tg1,tg2],[tg2,tg4],[tg6]] and the target group arn will come from the same module eg element(aws_lb_target_group.tg.*.arn)