Created
December 14, 2022 11:56
-
-
Save oliverlabs/67eb468bcddbcc13db2c5e922b6a66d7 to your computer and use it in GitHub Desktop.
Create an array of subnets on an existing VNet using 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.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