Bicep and Azure Firewall Management IP Configuration
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
Bicep CLI version 0.9.1
**Describe the bug**
When using Bicep to deploy Azure firewall using a variable with a condition on the managementIpConfiguration property it fails with error `The template variable 'variableName' is not found.`
**To Reproduce**
1. Create variable with condition
```bicep
var firwallMgmtConfig = (deployMgmtConfig) ? {
name: publicIpFirewallMgmt.name
properties: {
subnet: {
id: mgmtSubnetResourceId
}
publicIPAddress: {
id: publicIpFirewallMgmt.id
}
}
} : null
```
2. Set variable on `managementIpConfiguration` property.
```bicep
resource firewall 'Microsoft.Network/azureFirewalls@2022-01-01' = {
name: name
location: location
tags: tags
properties: {
sku: {
name: sku
tier: tier
}
ipConfigurations: [
{
name: publicIpFirewall.name
properties: {
subnet: {
id: subnetResourceId
}
publicIPAddress: {
id: publicIpFirewall.id
}
}
}
]
managementIpConfiguration: firwallMgmtConfig
}
}
```
**Additional context**
When moving the code from the variable directly to the property it works correctly.
```bicep
resource firewall 'Microsoft.Network/azureFirewalls@2022-01-01' = {
name: name
location: location
tags: tags
properties: {
sku: {
name: sku
tier: tier
}
ipConfigurations: [
{
name: publicIpFirewall.name
properties: {
subnet: {
id: subnetResourceId
}
publicIPAddress: {
id: publicIpFirewall.id
}
}
}
]
managementIpConfiguration: (deployMgmtConfig) ? {
name: publicIpFirewallMgmt.name
properties: {
subnet: {
id: mgmtSubnetResourceId
}
publicIPAddress: {
id: publicIpFirewallMgmt.id
}
}
} : null
firewallPolicy: {
id: firewallPolicy.id
}
}
}
```
Contributor guide
Research direction
Reproduce the failure with Bicep CLI 0.9.1 using the conditional variable assigned to managementIpConfiguration, then compare it with the inline conditional form shown in the issue. Done means the variable form compiles and deploys without the template variable error while preserving the conditional management configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100