How to realize creating multiple resources

Hi there!
I use Python for developing scripts.

Could someone explan how to realize constraction like this by using CDK:

resource “aws_autoscaling_attachment” “title” {
count = length(data.terraform_remote_state.xxxx.outputs.asg_ids)
autoscaling_group_name = element(data.terraform_remote_state.xxxx.outputs.asg_ids, count.index)
alb_target_group_arn =}

I have some problems:

  1. How to get length of the list of ids for ASG
  2. How to realize count.index

At this time I believe you’ll need to use escape hatches.
Something along the lines of:

attachments = AwsAutoscalingAttachment(self, 'title', ...)
attachments.add_override('count', 'length(...)')
attachments.add_override('autoscaling_group_name', 'element(...)')

Thanks a lot! I`ll try to use it.