-
Hello, Trying to output the subnet Ids and Names here and clearly my construct is wrong. Any help appreciated. The template output 'snetIds' is not valid. The language expression property 'name' doesn't exist, available properties are 'snetPrefix'.. var subnets = [
{
snetPrefix: '10.0.0.0/28'
}
{
snetPrefix: '10.0.0.16/28'
}
{
snetPrefix: '10.0.0.32/28'
}
{
snetPrefix: '10.0.0.48/28'
}
]
resource vnet 'Microsoft.Network/VirtualNetworks@2020-07-01' = {
name: toLower('${baseName}-${vnetSuffix}-1')
location: location
tags: resourceTags
properties: {
addressSpace: {
addressPrefixes: [
vnetAddressSpace
]
}
subnets: [for (subnet, i) in subnets: {
name: toLower('${baseName}-${snetSuffix}-${i + 1}')
properties: {
addressPrefix: subnet.snetPrefix
}
}]
}
}
output vnetId string = vnet.id //output resourceId of vnet
output snetIds array = [for subnet in subnets: {
subName: subnet.name
subId: subnet.Id
}] |
Beta Was this translation helpful? Give feedback.
Answered by
Vegas588
Mar 31, 2021
Replies: 2 comments 7 replies
-
Note that I think you just need to replace: output snetIds array = [for subnet in subnets: {
subName: subnet.name
subId: subnet.Id
}] With: output snetIds array = [for subnet in vnet.properties.subnets: {
subName: subnet.name
subId: subnet.id
}] |
Beta Was this translation helpful? Give feedback.
7 replies
-
Initial question answered by @anitian-mkimball |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Vegas588
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initial question answered by @anitian-mkimball