Created
August 8, 2023 15:27
-
-
Save oliverlabs/ea7fae473fcb83c1e02351dc3c0779a3 to your computer and use it in GitHub Desktop.
Create new virtual network subnets from an array in Bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var addressSpace = [ | |
'10.0.0.0/22' | |
] | |
var subnets = [ | |
{ | |
name: 'test1' | |
subnetPrefix: '10.0.3.0/26' | |
} | |
{ | |
name: 'test2' | |
subnetPrefix: '10.0.3.64/26' | |
} | |
{ | |
name: 'test3' | |
subnetPrefix: '10.0.3.128/26' | |
} | |
{ | |
name: 'test4' | |
subnetPrefix: '10.0.3.192/26' | |
} | |
] | |
resource VNET 'Microsoft.Network/virtualNetworks@2021-02-01' existing = { | |
name: 'ols-vnet' | |
} | |
@batchSize(1) | |
resource Subnets 'Microsoft.Network/virtualNetworks/subnets@2020-11-01' = [for (sn, index) in subnets: { | |
name: sn.name | |
parent: VNET | |
properties: { | |
addressPrefix: sn.subnetPrefix | |
} | |
}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment