Forum Discussion
Bicep & Pipeline - Deployment using old results/code
- Jul 13, 2022
Through trial & error, I've found the problem.
I have the following 2 modules which only run when a variable from a loaded JSON file is set to True:
module app_mod 'modules/app.bicep' = if (shr_var.env.deployApp == 'True') { scope: appGroup_res name: 'app_mod' params: { app_par: shr_var.app env_par: shr_var.env eventHubAuthId_par: logEndpoints_mod.outputs.eventHubAuthId eventHubName_par: logEndpoints_mod.outputs.eventHubName location_par: location_par resourceTags_par: resourceTags_var vaultAdminId_par: adminGroupId_par } } module gateway_mod 'modules/gateway.bicep' = if (shr_var.env.deployGateway == 'True') { scope: gatewayGroup_res name: 'gateway_mod' dependsOn:[ app_mod ] params: { env_par: shr_var.env eventHubAuthId_par: logEndpoints_mod.outputs.eventHubAuthId eventHubName_par: logEndpoints_mod.outputs.eventHubName gateway_par: shr_var.gateway location_par: location_par resourceTags_par: resourceTags_var } }Running the pipeline with no variables successfully skips the modules.
I then added this peering module which is conditional in the same way as the above modules but also has parameters that uses outputs from them:
module peerGwApp_mod 'modules/modular/vnetPeering.bicep' = if (shr_var.env.deployPeering == 'True') { scope: gatewayGroup_res name: 'peerGwApp_mod' params: { localVnetName_par: gateway_mod.outputs.vnetName remoteVnetId_par: app_mod.outputs.vnetId peeringName_par: 'peer-gw-app' } }Which causes all hell to break loose despite validation having no problems.
Regardless of what's in the module (all resource elements have been commented out), apparently conditionally declaring a module which has parameters that use outputs from other conditional modules (that don't run) makes the deployment absolutely foul itself in a spectacular way.
At the very least, validation or the deployment itself should return an error for unsupported implicit dependencies rather than the deployment showing previous results.
Where would the best place be for me to raise this bug?
Through trial & error, I've found the problem.
I have the following 2 modules which only run when a variable from a loaded JSON file is set to True:
module app_mod 'modules/app.bicep' = if (shr_var.env.deployApp == 'True') {
scope: appGroup_res
name: 'app_mod'
params: {
app_par: shr_var.app
env_par: shr_var.env
eventHubAuthId_par: logEndpoints_mod.outputs.eventHubAuthId
eventHubName_par: logEndpoints_mod.outputs.eventHubName
location_par: location_par
resourceTags_par: resourceTags_var
vaultAdminId_par: adminGroupId_par
}
}
module gateway_mod 'modules/gateway.bicep' = if (shr_var.env.deployGateway == 'True') {
scope: gatewayGroup_res
name: 'gateway_mod'
dependsOn:[
app_mod
]
params: {
env_par: shr_var.env
eventHubAuthId_par: logEndpoints_mod.outputs.eventHubAuthId
eventHubName_par: logEndpoints_mod.outputs.eventHubName
gateway_par: shr_var.gateway
location_par: location_par
resourceTags_par: resourceTags_var
}
}
Running the pipeline with no variables successfully skips the modules.
I then added this peering module which is conditional in the same way as the above modules but also has parameters that uses outputs from them:
module peerGwApp_mod 'modules/modular/vnetPeering.bicep' = if (shr_var.env.deployPeering == 'True') {
scope: gatewayGroup_res
name: 'peerGwApp_mod'
params: {
localVnetName_par: gateway_mod.outputs.vnetName
remoteVnetId_par: app_mod.outputs.vnetId
peeringName_par: 'peer-gw-app'
}
}
Which causes all hell to break loose despite validation having no problems.
Regardless of what's in the module (all resource elements have been commented out), apparently conditionally declaring a module which has parameters that use outputs from other conditional modules (that don't run) makes the deployment absolutely foul itself in a spectacular way.
At the very least, validation or the deployment itself should return an error for unsupported implicit dependencies rather than the deployment showing previous results.
Where would the best place be for me to raise this bug?