I am trying to reference and existing bicep module as a parent of another resource.
module vnethub 'modules/vnet/vnet.bicep' = {
scope: resourceGroup(rg.name)
name: 'hub-VNet'
params: {
vnetAddressSpace: {
addressPrefixes: hubVNETaddPrefixes
}
vnetNamePrefix: 'hub'
subnets: [
hubVNETdefaultSubnet
hubVNETfirewalSubnet
hubVNETVMSubnet
hubVNETBastionSubnet
]
}
dependsOn: [
rg
]
}
.
.
.
resource subnetfw 'Microsoft.Network/virtualNetworks/subnets@2020-11-01' existing = {
scope: resourceGroup(rg.name)
name: '${vnethub.name}/AzureFirewallSubnet'
parent: vnethub
}
when I do this I get an error on execution
Error BCP036: The property "parent" expected a value of type "Microsoft.Network/virtualNetworks" but the provided value is of type "module"
what am I doing wrong?