You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Bicep does not report an error and allows construction as below but when compiled to ARM, module scope (resourceGroup property in ARM-json) is not emitted.
To Reproduce
targetScope = 'subscription'vargroups = [
{
name: 'group1'location: 'westus'
}
{
name: 'group2'location: 'eastus'
}
]
resourcerg0'Microsoft.Resources/resourceGroups@2022-09-01' = {
name: 'group0'location: 'centralus'
}
resource_rg'Microsoft.Resources/resourceGroups@2022-09-01' = [for (item, index) ingroups: {
name: item.namelocation: item.location
}]
varrg = {
group1: _rg[0]
group2: _rg[1]
}
varx = _rg[1]
vary = rg0modulemod1'nullmod.bicep' = {
name: 'mod1'scope: _rg[0]
}
modulemod2'nullmod.bicep' = {
name: 'mod2'scope: rg.group2
}
modulemod3'nullmod.bicep' = {
name: 'mod3'scope: x
}
modulemod4'nullmod.bicep' = {
name: 'mod4'scope: y// here is an error but it totally does not relate to why we can't do this
}
Only for mod1 the property resourceGroup is emitted, but for others (mod2, mod3) aren't plus for mod4 there's a bicep 120 error: This expression is being used in an assignment to the "scope" property of the "module" type, which requires a value that can be calculated at the start of the deployment. You are referencing a variable which cannot be calculated at the start ("y" -> "rg0"). Properties of rg0 which can be calculated at the start include "apiVersion", "id", "name", "type".bicep(BCP120)
The text was updated successfully, but these errors were encountered:
This is going to be a pretty involved fix - ultimately we need to be able to use the IR earlier in the Bicep build process, and perform analysis + raise diagnostics as we go along.
Adding to 1.0 release for now as I'm not sure we'll be able to get to it sooner.
Bicep version
0.16.2
Describe the bug
Bicep does not report an error and allows construction as below but when compiled to ARM, module scope (
resourceGroup
property in ARM-json) is not emitted.To Reproduce
Only for
mod1
the propertyresourceGroup
is emitted, but for others (mod2, mod3) aren't plus for mod4 there's a bicep 120 error:This expression is being used in an assignment to the "scope" property of the "module" type, which requires a value that can be calculated at the start of the deployment. You are referencing a variable which cannot be calculated at the start ("y" -> "rg0"). Properties of rg0 which can be calculated at the start include "apiVersion", "id", "name", "type".bicep(BCP120)
The text was updated successfully, but these errors were encountered: