Created
August 19, 2021 15:44
-
-
Save larryclaman/347d8647555fd014223baf3615c77e49 to your computer and use it in GitHub Desktop.
bicep create subnets from loop
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
// from https://github.com/Azure/bicep/discussions/3449 | |
var addressSpace = [ | |
'10.144.0.0/16' | |
] | |
var subnets = [ | |
{ | |
name: 'api' | |
subnetPrefix: '10.144.0.0/24' | |
} | |
{ | |
name: 'worker' | |
subnetPrefix: '10.144.1.0/24' | |
} | |
] | |
resource VNET 'Microsoft.Network/virtualNetworks@2021-02-01' = { | |
name: 'vnet1' | |
location: resourceGroup().location | |
properties: { | |
addressSpace: { | |
addressPrefixes: addressSpace | |
} | |
} | |
} | |
@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