For loop in serverless.yml

HI Team,

We are having scenario to write a for loop inside yml file
I tried using Fn:Split / !Split function, though its working but I am not able to separate the strings and join with other string.

  • !Split [ “,” , ${self:custom.connectInstanceId} ]

Need to join like this

  • “instance/${self:custom.connectInstanceId0}/routing-profile/*”
  • “instance/${self:custom.connectseondInstanceId1}/routing-profile/*”

Can you please guide me on this.

Second query is
I need to pass array of string and create an roles dynamically from dynamodb, so Is it possible to call node.js file from .yml file

Please guide me