There is a list of strings which are the output of vnet peering details. I need to extract all the source vnet names in one list and destination vnet names in another list. My vnet peering names are as below
Peer =["vnet1tovnet2",
"vnet1tovnet3",
"vnet4tovnet5"]
I need two lists in below format
source=["vnet1","vnet1",vnet4"]
dest=["vnet2","vnet3","vnet5"]
How can this be achieved in terraform
You can do that as follows: