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
So I encountered a previous issue which can be found in #10549. This was said to be fixed in 0.17.1, but now it is even more broken. I would like to know if what I am doing will ever be possible or, if not, how I could get around the problem? What I am trying to do is using the output from a module, that contains a for loop. I create, for example, 2 public IPs by calling a module and then I want to use the output inside of a variable (see example below). I don't understand why this doesn't work and would like some help how you guys would make this work?
To Reproduce
I have a bicep file that simply creates a Public IP address called publicIpAddress.bicep:
@description('The name of the public IP resource.')
parampublicIpAddressNamestring
@description('The Azure region into which the resources should be deployed.')
paramlocationstring
@description('The public IP address allocation method.')
parampublicIpAddressTypestring
@description('Name of a public IP address SKU.')
parampublicIpAddressSkustringresourcepublicIpAddress'Microsoft.Network/publicIPAddresses@2022-07-01' = {
name: toUpper(publicIpAddressName)
location: locationproperties: {
publicIPAllocationMethod: publicIpAddressType
}
sku: {
name: publicIpAddressSku
}
}
outputpublicIPIdstring = publicIpAddress.id
I call this module in another file and would like to use the outputed ID of the public IP address in a variable. See the code below:
The error that the linter gives (inside the variable at the line where I put the comment) is the following: This expression is being used in the for-body of the variable "frontendIPConfigurationsMapper", which requires values that can be calculated at the start of the deployment. The property "outputs" of publicIpModule cannot be calculated at the start. Properties of publicIpModule which can be calculated at the start include "name".bicep(BCP182)
Additional context
Previous issue that I created: #10549
The text was updated successfully, but these errors were encountered:
TheCrazyCanian
changed the title
Output of modules, that are created in a for loop, can not be used.
Output of modules, that are created in a for loop, can not be used in 0.17.1.
May 11, 2023
The error is by design. Referencing a runtime property in a for loop is never a supported feature due to a limitation of the ARM deployment engine. We added validation for runtime property validation a while ago, but there was a regression that caused the NotImplementedException reported in #10549. The fix was just to bring back the error message.
Leaving this open as an enhancement. We can investigate in the future if there is anything we can do to overcome the ARM deployment engine limitation and add support for runtime property references in loops.
Bicep version
Bicep CLI version 0.17.1 (d423d61)
Describe the bug
So I encountered a previous issue which can be found in #10549. This was said to be fixed in 0.17.1, but now it is even more broken. I would like to know if what I am doing will ever be possible or, if not, how I could get around the problem? What I am trying to do is using the output from a module, that contains a for loop. I create, for example, 2 public IPs by calling a module and then I want to use the output inside of a variable (see example below). I don't understand why this doesn't work and would like some help how you guys would make this work?
To Reproduce
I have a bicep file that simply creates a Public IP address called publicIpAddress.bicep:
I call this module in another file and would like to use the outputed ID of the public IP address in a variable. See the code below:
The publicIpAddresses parameter that is used above looks like this:
The error that the linter gives (inside the variable at the line where I put the comment) is the following:
This expression is being used in the for-body of the variable "frontendIPConfigurationsMapper", which requires values that can be calculated at the start of the deployment. The property "outputs" of publicIpModule cannot be calculated at the start. Properties of publicIpModule which can be calculated at the start include "name".bicep(BCP182)
Additional context
Previous issue that I created: #10549
The text was updated successfully, but these errors were encountered: