Skip to content

Conversation

@mikebijl
Copy link

@mikebijl mikebijl commented Nov 14, 2025

  • Added new type ipamPoolPrefixAllocationsType for IPAM pool prefix allocations.
  • Updated subnetType to use the new ipamPoolPrefixAllocationsType instead of the previous inline definition.
  • fixed issue with bicep-docs that failed due to the way ipamPoolPrefixAllocationsType was defined

Description

Pipeline Reference

Pipeline

Type of Change

  • Azure Verified Module updates:
    • Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in version.json:
    • Feature update backwards compatible feature updates, and I have bumped the MINOR version in version.json.
    • Breaking changes and I have bumped the MAJOR version in version.json.
    • Update to documentation
  • Update to CI Environment or utilities (Non-module affecting changes)

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • I have run Set-AVMModule locally to generate the supporting module files.
  • My corresponding pipelines / checks run clean and green without any errors or warnings
  • I have updated the module's CHANGELOG.md file with an entry for the next version

- Added new type `ipamPoolPrefixAllocationsType` for IPAM pool prefix allocations.
- Updated `subnetType` to use the new `ipamPoolPrefixAllocationsType` instead of the previous inline definition.
- fixed issue with bicep-docs that failed due to the way ipamPoolPrefixAllocationsType was defined
@mikebijl mikebijl requested review from a team as code owners November 14, 2025 15:45
@avm-organizer avm-organizer bot added the Needs: Module Owner 📣 This module needs an owner to develop or maintain it label Nov 14, 2025
@avm-organizer avm-organizer bot requested a review from mjrich19 November 14, 2025 15:46
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Triage 🔍 Maintainers need to triage still Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue labels Nov 14, 2025
@mikebijl mikebijl changed the title [FIX] AVM-RES: Update ipamPoolPrefixAllocations in vNet module fix - AVM-RES: Update ipamPoolPrefixAllocations in vNet module Nov 14, 2025
@mikebijl mikebijl changed the title fix - AVM-RES: Update ipamPoolPrefixAllocations in vNet module fix: AVM-RES: Update ipamPoolPrefixAllocations type in virtual-network module Nov 14, 2025
@AlexanderSehr AlexanderSehr linked an issue Nov 24, 2025 that may be closed by this pull request
1 task
@AlexanderSehr
Copy link
Collaborator

Hey @mikebijl,
thank you for the fix in this PR. Any chance you could follow the contribution guide to validate the contents of this PR (ref)?

Most importantly, add a pipeline badge that shows the static & deployment tests passing for the changes? In this case they'd definitely fail the static ones, but may pass the deployment tests.

To get the static tests sorted, please run the Set-AVMModule script (ref) once on the module's root and push the updated files :)

remotePeeringUseRemoteGateways: bool?
}

type ipamPoolPrefixAllocationsType = {
Copy link
Collaborator

@AlexanderSehr AlexanderSehr Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few thoughts from my end, considering the AVM specs:

  1. I'd suggest to move this type into the subnet child-module, use it there and import it here. This allows you to use it in both places
  2. The 'id' definition should either be changed to poolResourceId, or remain an object but be renamed to resourceId. In AVM we strongly advice against using id only as it can conflict with other resources that use id for entirely different meanings. In either case, the subnet module would need to then pass the value on to the id property of the resource type implementation
  3. The numberOfIpAddresses should, for a similar spec, be declared as a integer, and where it is used be translated to a string. This is simply adviced as strings a way more error prone than integers.

Example (in the subnet module)

Option 1
@description('Conditional. The address space for the subnet, deployed from IPAM Pool. Required if `addressPrefixes` and `addressPrefix` is empty.')
param ipamPoolPrefixAllocations ipamPoolPrefixAllocationsType[]?

resource subnet 'Microsoft.Network/virtualNetworks/subnets@2024-05-01' = {
  name: name
  parent: virtualNetwork
  properties: {
    ipamPoolPrefixAllocations: map(ipamPoolPrefixAllocations ?? [], allocation => {
      pool: {
        id: allocation.pool.resourceId
      }
      numberOfIpAddresses: string(allocation.numberOfIpAddresses)
    })
   (...)
}

(...)

@export()
@description('The type of an IPAM-Pool prefix allocation.')
type ipamPoolPrefixAllocationsType = {
  @description('Required. The IPAM pool.')
  pool: {
    @description('Required. The Resource ID of the IPAM pool.')
    resourceId: string
  }
  @description('Required. Number of IP addresses allocated from the pool.')
  numberOfIpAddresses: int
}

Usage:

subnets: {
  name: 'subnet-1'
  ipamPoolPrefixAllocations: [
    {
      pool: {
        resourceId: nestedDependencies.outputs.networkManagerIpamPoolId
      }
      numberOfIpAddresses: 16
    }
    {
      pool: {
        resourceId: nestedDependencies.outputs.networkManagerIpamPoolId
      }
      numberOfIpAddresses: 8
    }
  ]
}
Option 2
@description('Conditional. The address space for the subnet, deployed from IPAM Pool. Required if `addressPrefixes` and `addressPrefix` is empty.')
param ipamPoolPrefixAllocations ipamPoolPrefixAllocationsType[]?

resource subnet 'Microsoft.Network/virtualNetworks/subnets@2024-05-01' = {
  name: name
  parent: virtualNetwork
  properties: {
    ipamPoolPrefixAllocations: map(ipamPoolPrefixAllocations ?? [], allocation => {
      pool: {
        id: allocation.poolResourceId
      }
      numberOfIpAddresses: string(allocation.numberOfIpAddresses)
    })
   (...)
}

(...)

@export()
@description('The type of an IPAM-Pool prefix allocation.')
type ipamPoolPrefixAllocationsType = {
  @description('Required. The IPAM pool resource Id.')
  poolResourceId: string

  @description('Required. Number of IP addresses allocated from the pool.')
  numberOfIpAddresses: int
}

Usage:

subnets: {
  name: 'subnet-1'
  ipamPoolPrefixAllocations: [
    {
      poolResourceId: nestedDependencies.outputs.networkManagerIpamPoolId
      numberOfIpAddresses: 16
    }
    {
      poolResourceId: nestedDependencies.outputs.networkManagerIpamPoolId
      numberOfIpAddresses: 8
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Module Owner 📣 This module needs an owner to develop or maintain it Needs: Triage 🔍 Maintainers need to triage still Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AVM Module Issue]: type subnetType is causing issues icw bicep-docs

3 participants