Azure / bicep-registry-modules

Bicep registry modules
MIT License
506 stars 351 forks source link

[AVM Module Issue]: bicep virtual-network service endpoint examples incorrect #3323

Closed michaelpace-bjss closed 1 month ago

michaelpace-bjss commented 1 month ago

Check for previous/existing GitHub issues

Issue Type?

I'm not sure

Module Name

avm/res/network/virtual-network

(Optional) Module Version

No response

Description

AVM Bicep documentation for adding service endpoints to a virtual network subnet, indicates you should pass an array of strings, e.g.

subnets: [
      {
        name: 'default'
        addressPrefix: '10.0.0.0/26'
        serviceEndpoints: [
          'Microsoft.Storage'
          'Microsoft.Sql'
        ]
      }
    ]

However, deployment of this code will generate the following error: "InvalidJsonResourceType - Value for resource type Microsoft.WindowsAzure.Networking.Nrp.Frontend.Contract.Csm.Public.VirtualNetwork is invalid, exception: Could not cast or convert from System.String to Microsoft.WindowsAzure.Networking.Nrp.Frontend.Contract.Csm.Public.ServiceTunnel."

The documentation examples should be modified to:

subnets: [
      {
        name: 'default'
        addressPrefix: '10.0.0.0/26'
        serviceEndpoints: [
          {
            service: 'Microsoft.Storage'
          }
          {
            service: 'Microsoft.Sql'
          }
        ]
      }
    ]

(Optional) Correlation Id

No response

avm-team-linter[bot] commented 1 month ago

@michaelpace-bjss, thanks for submitting this issue for the avm/res/network/virtual-network module!

[!IMPORTANT] A member of the @Azure/avm-res-network-virtualnetwork-module-owners-bicep or @Azure/avm-res-network-virtualnetwork-module-contributors-bicep team will review it soon!

AlexanderSehr commented 1 month ago

Good day @michaelpace-bjss, the examples are actually generated from the deployment test cases (in the /tests/e2e/... folders. In other words, they're deployed for every module tests to validate they work.

I also just took a quick look at the virtual-network/subnet module, and the converation you're suggesting is implemented by the module itself which is why it's only asking for a string array:

https://github.com/Azure/bicep-registry-modules/blob/2a435324edf8b63919af3c97b20eea38f14ef218/avm/res/network/virtual-network/subnet/main.bicep#L117-L121

Are you using an older version of the module by any chance?

michaelpace-bjss commented 1 month ago

@AlexanderSehr. Bad timing on my part. Started using writing bicep the day before published updates to module and tested the day after and didn't spot the version change. School boy error. Issue closed.