Skip to content

Instantly share code, notes, and snippets.

@oliverlabs
Created December 14, 2022 11:56
Show Gist options
  • Save oliverlabs/67eb468bcddbcc13db2c5e922b6a66d7 to your computer and use it in GitHub Desktop.
Save oliverlabs/67eb468bcddbcc13db2c5e922b6a66d7 to your computer and use it in GitHub Desktop.
Create an array of subnets on an existing VNet using Bicep
// var addressSpace = [
// '10.1.0.0/16'
// ]
var subnets = [
{
name: 'api'
subnetPrefix: '10.1.66.0/24'
}
{
name: 'worker'
subnetPrefix: '10.1.67.0/24'
}
]
resource VNET 'Microsoft.Network/virtualNetworks@2021-02-01' existing = {
name: 'tf-vnetwork-01'
}
@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