Azure / bicep-registry-modules

Bicep registry modules
MIT License
460 stars 305 forks source link

NSG association does not work: avm/res/network/virtual-network #2794

Closed jeetgarg closed 1 month ago

jeetgarg commented 1 month ago

Check for previous/existing GitHub issues

Issue Type?

Bug

Module Name

avm/res/network/virtual-network

(Optional) Module Version

No response

Description

NSG Association to the subnet does not work while using the module. However, it does work if resources are called directly. I am not sure but i think the piece around NSG is not right in the code:

networkSecurityGroup: contains(subnet, 'networkSecurityGroupResourceId') && !empty(subnet.networkSecurityGroupResourceId)
            ? {
                id: subnet.networkSecurityGroupResourceId
              }
            : null

I might be wrong but it should be:

networkSecurityGroup: contains(subnet, 'networkSecurityGroupResourceId') && empty(subnet.networkSecurityGroupResourceId)
            ? {
                id: subnet.networkSecurityGroupResourceId
              }
            : null

I have deployed multiple times using the module, but its not successful.

(Optional) Correlation Id

No response

microsoft-github-policy-service[bot] commented 1 month ago

[!IMPORTANT] The "Needs: Triage :mag:" label must be removed once the triage process is complete!

[!TIP] For additional guidance on how to triage this issue/PR, see the BRM Issue Triage documentation.

jeetgarg commented 1 month ago

Created wrongly.