Azure / ALZ-Bicep

This repository contains the Azure Landing Zones (ALZ) Bicep modules that help deliver and deploy the Azure Landing Zone conceptual architecture in a modular approach. https://aka.ms/alz/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type Validation Incorrect for vwanConnectivity Module

lsuarez5280 opened this issue · comments

What happened? Provide a clear and concise description of the bug, including deployment details.

When attempting to deploy Virtual WAN Hub connectivity using AS-Path routing preference for my hubs, I am presented with a validation error for providing the correct configuration value of ASPath, incorrectly indicating that I should choose instead ASN.

There is an error in the current type definition for the module:

  @sys.description('The Virtual WAN Hub routing preference. The allowed values are `ASN`, `VpnGateway`, `ExpressRoute`.')
  parHubRoutingPreference: ('ExpressRoute' | 'VpnGateway' | 'ASN')

Note the documentation for the ARM API version in use indicates the following enumerated values:

Name Description Value
hubRoutingPreference The hubRoutingPreference of this VirtualHub. 'ASPath'
'ExpressRoute'
'VpnGateway'

The raw value is used directly in the module resource declaration as opposed to being mapped from ASN to the correct value, as replicated below:

resource resVhub 'Microsoft.Network/virtualHubs@2023-04-01' = [for hub in parVirtualWanHubs: if (parVirtualHubEnabled && !empty(hub.parVirtualHubAddressPrefix)) {
  name: hub.?parVirtualWanHubCustomName ?? '${parVirtualWanHubName}-${hub.parHubLocation}'
  location: hub.parHubLocation
  tags: parTags
  properties: {
    addressPrefix: hub.parVirtualHubAddressPrefix
    sku: 'Standard'
    virtualWan: {
      id: resVwan.id
    }
    virtualRouterAutoScaleConfiguration: {
      minCapacity: hub.parVirtualRouterAutoScaleConfiguration
    }
    hubRoutingPreference: hub.parHubRoutingPreference
  }
}]

Please provide the correlation id associated with your error or bug.

N/A for preflight template validation

What was the expected outcome?

Type validation should conform to the API version in use or map from the input value to a correct value for the API.

Relevant log output

New-AzResourceGroupDeployment: /home/vsts/work/1/s/pipeline-scripts/Deploy-ALZHub-VWAN.ps1:30
Line |
  30 |  New-AzResourceGroupDeployment @inputObject
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 14:53:06 - Error: Code=InvalidTemplate; Message=Deployment template
     | validation failed: 'The provided value for the template parameter
     | 'parVirtualWanHubs[0].parHubRoutingPreference' is not valid. The value
     | 'ASPath' is not part of the allowed value(s):
     | 'ASN,ExpressRoute,VpnGateway'.'.


### Check previous GitHub issues

- [X] I have searched the issues for this item and found no duplicate

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

Thanks for calling this out @lsuarez5280, I will work on getting this in. We would also welcome a PR from you as well if you're interested.