Support evaluating resource IDs from symbolic names within the same resource
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
Some resources, such as load balancers, require referencing resource IDs as part of the properties of the resource definition, but those resource IDs are child resources of the resource itself. This means that Bicep detects this as a circular reference. For example, if I have a load balancer (simplified definition) like this:
```bicep
resource loadBalancer 'Microsoft.Network/loadBalancers@2020-06-01' = {
name: loadBalancerName
location: location
sku: {
name: 'Standard'
}
properties: {
frontendIPConfigurations: [
{
name: frontendIPConfigurationName
properties: {
privateIPAllocationMethod: 'Dynamic'
subnet: {
id: subnetResourceId
}
}
}
]
loadBalancingRules: [
{
name: 'HttpRule'
properties: {
frontendIPConfiguration: {
id: loadBalancer.properties.frontendIPConfigurations[0].id
}
}
]
}
}
```
then this line causes a circular reference:
```bicep
id: loadBalancer.properties.frontendIPConfigurations[0].id
```
The workaround is to use the `resourceId()` function directly. However, it would be nicer if Bicep could allow this scenario using the symbolic reference instead.
Contributor guide
Research direction
Start with the load balancer resource example and the expression referencing loadBalancer.properties.frontendIPConfigurations[0].id. Investigate how Bicep detects circular references and how resourceId() avoids them. Done means symbolic references to child resource IDs within the same resource are accepted without a circular-reference error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100