Iterating over vm objects (name/IP addresses) using "for_each" in vmware esxi

When i am using for_each in the module to loop over the vm name, i could see that vm names are picking up from the “each.key” very well but the networks does not pick from the list of ip addresses and it eventually picking the 1st IP address from the list of all the IP addresses given in the network field. Now all the instances are created with the single ip address on all of them.

Is there any other way where we can loop over the vm name keeping the IP addresses coming from the network field.

Configuration are as below:

variable “vm-name” {
default = [“testing01”, “client01”, “sandbox01”]
}

for_each = toset(var.vm-name)
vmname = each.key
network = {
“Network01” = [“192.168.112”, “192.168.113”, “192.168.114”]

All vm’s are created with the same IP address: 192.168.112. If i remove the for_each and use the instances=3 then all the instances are getting different IP address respectively.

TIA