Azure/bicep

False positive with `use-resource-id-functions` linter rule

Opened this issue · 4 comments

Reproduced in Bicep v0.30.23

The following is valid, but causes the use-resource-id-functions warning to show:

resource foo 'Microsoft.Network/publicIPAddresses@2024-01-01' existing = {
  name: 'foo'
}

var frontends = [
  {
    name: 'foo'
    id: foo.id
  }
]

resource loadBalancer 'Microsoft.Network/loadBalancers@2023-11-01' = {
  name: 'bar'
  location: 'westus'
  sku: { name: 'Standard' }
  properties: {
    frontendIPConfigurations: [for frontend in frontends: {
        name: frontend.name
        properties: {
          publicIPAddress: { id: frontend.id }
        }
      }
    ]
  }
}

We have a few similar issues: #10732, #14136, #8104.

I'm wondering if we should disable this linter rule by default if it is unreliable.

@StephenWeatherford , can you take a look. I agree with Anthony. We should disable by default if it is unrealiable.

We'll disable by default for now.

@anthony-c-martin I think you mean false positive, not negative, correcting the title.