Problem
“privateendpoints.bicep” is a module that builds a private endpoint as follows:
resource privateEndpoint_resource 'Microsoft.Network/privateEndpoints@2020-07-01' = {
name: privateEndpointName
location: resourceGroup().location
properties: {
subnet: {
id: '${vnet_resource.id}/subnets/${subnetName}'
}
privateLinkServiceConnections: [
{
name: privateEndpointName
properties: {
privateLinkServiceId: resourceId
groupIds: [
pvtEndpointGroupName_var
]
}
}
]
}
}
output privateEndpointIpAddress string = privateEndpoint_resource.properties.networkInterfaces[0].properties.ipConfigurations[0].properties.privateIPAddress
A calling bicep file then refers to this as follows:
module sqlPE '../../Azure.Modules/Microsoft.Network.PrivateEndpoints/1.0.0/privateendpoints.bicep' = {
name:'sqlPE'
params:{
privateEndpointName:'pe-utrngen-sql-${env}-001'
resourceId:sqlDeploy.outputs.sqlServerId
serviceType:'sql'
subnetName:'sub-${env}-utrngenerator01'
vnetName:'vnet-${env}-uksouth'
vnetResourceGroup:'rg-net-${env}-001'
}
}
var sqlPrivateLinkIpAddress = sqlPE.outputs.privateEndpointIpAddress
My issue is that it will not construct. I’m getting an error in VSCode. The property “privateEndpointIpAddress” does not exist in the type “outputs.”
This is the new property I’ve created. Everything worked fine before I added it. I made sure to save the revised external module and that I right-clicked it in VSCode and selected build, which resulted in a successful build and the creation of a json file.
As a result, it appears that changes in the external module are not being picked up by the client bicep file.
Any suggestions please?
Asked by Rob Bowman
Solution #1
The fact that I had the external module open in a different VS Code instance appeared to be the source of the problem. It worked fine after I closed this and opened the file in the same instance as the calling bicep file.
Answered by Rob Bowman
Post is based on https://stackoverflow.com/questions/70070032/azure-bicep-cant-access-output-from-external-module