Azure / Azure/bicep

Add ability to calculate number of subnets to CIDR functions

Open
#10,851 0 comments 3 reactions 0 assignees View on GitHub
enhancement Needs: Upvote
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 2h
Merged PRs (30d)
79

Description

In addition to the currently [available CIDR functions](https://learn.microsoft.com/azure/azure-resource-manager/bicep/bicep-functions-cidr), I would also like to be able to calculate how many subnets could be carved out. This function would return a single integer.

**Describe the solution you'd like**

Example:

```bicep
var maxSubnets = cidrSubnetCount(network, newCIDR)
```

For `network = 10.0.0.0/16` and `newCIDR = 24`, this would return `256`.

Contributor guide

Open the contributing guide

Research direction

Read the linked CIDR functions documentation first to understand the existing function behavior and naming. Use the issue's 10.0.0.0/16 and /24 example as the initial expected result, then verify that the new function returns the correct subnet count for equivalent CIDR inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.