-
Hi, I am trying to figure out how to the following properly in bicep, I searched through loop examples but could not produce anything that would work, so: I am deploying several VMs and NICs like so: resource VMNIC 'Microsoft.Network/networkInterfaces@2021-02-01' = [for i in range(0,3): {
name: '$VM0${i+1}-NIC'
location: general.location
properties: {
ipConfigurations: [
{
name: 'ipconfig1'
properties: {
privateIPAllocationMethod: 'Dynamic'
subnet: {
id: subnetvm.id
}
applicationSecurityGroups: [
{
id: vmasg.id
}
]
}
}
]
}
}] What I would like to achieve is somehow predefine IPs, like: var staticIps = [
'172.150.2.50'
'172.150.2.55'
'172.150.2.60'
]
resource VMNIC 'Microsoft.Network/networkInterfaces@2021-02-01' = [for i in range(0,3): {
name: '$VM0${i+1}-NIC'
location: general.location
properties: {
ipConfigurations: [
{
name: 'ipconfig1'
properties: {
privateIPAllocationMethod: 'Static'
privateIPAddress: [for IPS in staticIps....] //DO LOOP MAGIC HERE, so it takes each IP for each different NIC
subnet: {
id: subnetvm.id
}
applicationSecurityGroups: [
{
id: vmasg.id
}
]
}
}
]
}
}]
How would I achieve this? |
Beta Was this translation helpful? Give feedback.
Answered by
azMantas
Aug 10, 2022
Replies: 1 comment 7 replies
-
did you tried to loop over staticIP instead of range(0,3) where private IP adr is 'i' |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
brwilkinson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
did you tried to loop over staticIP instead of range(0,3) where private IP adr is 'i'