Azure / bicep

Bicep is a declarative language for describing and deploying Azure resources
MIT License
3.2k stars 742 forks source link

Error BCP037: The property "frontEndIpConfigurationName" is not allowed on objects of type "params". No other properties are allowed. #9043

Closed dazinator closed 1 year ago

dazinator commented 1 year ago

Bicep version Bicep CLI version 0.11.1 **(030248df55)**

Describe the bug I moved my load balancer resource into a module, and exposed a parameter for the front end ip config name:

@description('name of the front end ip configuration that is created for the ip address.')
param frontEndIpConfigurationName string 

resource loadBalancer 'Microsoft.Network/loadBalancers@2022-05-01' = {
  name: name
  location: location  
  properties: {
    frontendIPConfigurations: [
      {
        name: frontEndIpConfigurationName  

In main.bicep I included this module and set this param


var outboundRuleName = 'rule-${stackName}-${envMap[environmentType].shortName}-${shortLocationName}-01'
var frontEndIpConfigurationName = 'ipConfig1'
module loadBalancer 'modules/load-balancer.bicep' = {
  name: 'loadBalancer'
  params: {
    name: loadBalancerName
    location: location
    publicIpAddressId: loadBalancerPublicIp.outputs.ipAddressId
    backendAddressPoolName: swarmClusterBackendAddressPoolName
    frontEndIpConfigurationName: frontEndIpConfigurationName

No editor warnings or errors at this point. Proceeded to deploy - resulted in an error

Error BCP037: The property "frontEndIpConfigurationName" is not allowed on objects of type "params". No other properties are allowed.   

Renaming the parameter from frontEndIpConfigurationName to something else solves the problem.

It seemed to me like this parameter name has some kind of special treatment in bicep.

To Reproduce As per above

Additional context

jeskew commented 1 year ago

Could you provide the full template for main.bicep and modules/load-balancer.bicep?

I tried to create a minimal reproduction but didn't run into any errors with the following templates:

main.bicep

module mod 'mod.bicep' = {
  name: 'mod'
  params: {
    frontEndIpConfigurationName: 'frontEndIpConfigurationName'
  }
}

mod.bicep

param frontEndIpConfigurationName string

The BCP037 error posted would be raised when the module has no parameter named "frontEndIpConfigurationName" and no parameters remained unspecified. Had modules/load-balancer.bicep been saved with the new parameter when you ran into the error?

dazinator commented 1 year ago

@jeskew i've updated to latest bicep version since it happened, and I can no longer reproduce. I would like to think I had checked the file was saved, however perhaps there was an issue. Happy to close for now, will reopen if it crops up again.