Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

References in VNet peerings are not resolved to the actually value of the reference #350

Open
HorizonNet opened this issue Jan 2, 2024 · 1 comment

Comments

@HorizonNet
Copy link

Describe the noise

Resource type Microsoft.Network/virtualNetworks

apiVersion 2023-06-01

Client Azure CLI

Relevant ARM Template code (we only need the resource object for the above resourceType and apiVersion, but if it's easier you can include the entire template

resource xxx 'Microsoft.Network/virtualNetworks@2023-06-01' = {
  name: 'xxx'
  location: 'germanywestcentral'

  properties: {
    ...

    virtualNetworkPeerings: [
      {
        name: network.name

        properties: {
          peeringState: 'Connected'
          peeringSyncLevel: 'FullyInSync'

          remoteVirtualNetwork: {
            id: network.id
          }

          allowVirtualNetworkAccess: true
          allowForwardedTraffic: false
          allowGatewayTransit: false
          useRemoteGateways: false
          doNotVerifyRemoteGateways: false

          remoteAddressSpace: {
            addressPrefixes: [
              network.properties.addressSpace.addressPrefixes[0]
            ]
          }

          remoteVirtualNetworkAddressSpace: {
            addressPrefixes: [
              network.properties.addressSpace.addressPrefixes[0]
            ]
          }
        }
      }
    ]

    enableDdosProtection: false
  }

  ...
}

@description('Remote VNet to peer with')
resource network 'Microsoft.Network/virtualNetworks@2023-06-01' existing = {
  name: 'network'
  scope: resourceGroup('aaa')
}

Expected response (i.e. "I expected no noise since the template has not been modified since the resources were deployed)

I expected no noise and the deployment instead picking up the appropriate address prefixes from the referenced resource instead of showing a change in the address prefix for the remote VNet.

Current (noisy) response (either include a screenshot of the what-if output, or copy/paste the text)

  ~ Microsoft.Network/virtualNetworks/xxx [2023-06-01]
    ~ properties.virtualNetworkPeerings: [
      ~ 0:

        - properties.peerCompleteVnets: true
        ~ properties.remoteAddressSpace.addressPrefixes: [
          - 0: "xx.xx.x.x/16"
          + 0: "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'aaa'), 'Microsoft.Network/virtualNetworks', 'network'), '2023-06-01').addressSpace.addressPrefixes[0]]"
          ]
        ~ properties.remoteVirtualNetworkAddressSpace.addressPrefixes: [
          - 0: "xx.xx.x.x/16"
          + 0: "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, 'aaa'), 'Microsoft.Network/virtualNetworks', 'network'), '2023-06-01').addressSpace.addressPrefixes[0]]"
          ]

      ]

Additional context
Add any other context about the problem here.

@erikrosegs
Copy link

I believe this is a consequence of the behavior described in this issue: #83

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants