Skip to content

Commit e5555cd

Browse files
authored
clarify network parameter behavior for new vs existing VNet in main.bicepparam (#329)
Updated comments to clarify network configuration behavior based on existing VNet resource ID.
1 parent 7e6a79f commit e5555cd

File tree

1 file changed

+20
-3
lines changed
  • samples/microsoft/infrastructure-setup/15-private-network-standard-agent-setup

1 file changed

+20
-3
lines changed

samples/microsoft/infrastructure-setup/15-private-network-standard-agent-setup/main.bicepparam

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,26 @@ param dnsZoneNames = [
4242
]
4343

4444

45-
// Network configuration: only used when existingVnetResourceId is not provided
46-
// These addresses are only used when creating a new VNet and subnets
47-
// If you provide existingVnetResourceId, these values will be ignored
45+
// Network configuration (behavior depends on `existingVnetResourceId`)
46+
//
47+
// - NEW VNet (existingVnetResourceId is empty):
48+
// The values below are used to CREATE the VNet and the two subnets.
49+
// Provide explicit, non-overlapping CIDR ranges when creating a new VNet.
50+
//
51+
// - EXISTING VNet (existingVnetResourceId is provided):
52+
// The module will reference the existing VNet. Subnet handling depends on the
53+
// values you provide:
54+
// * If `agentSubnetPrefix` or `peSubnetPrefix` are empty, the module may
55+
// auto-derive subnet CIDRs from the existing VNet's address space
56+
// (using cidrSubnet). This can produce /24 (or configured) subnets
57+
// starting at index 0, 1, etc.
58+
// * If you provide explicit subnet prefixes, the module will attempt to
59+
// create or update subnets with those prefixes in the existing VNet.
60+
//
61+
// Important operational notes and risks (when existingVnetResourceId is provided):
62+
// - Avoid CIDR overlaps with any existing subnets in the target VNet. Overlap
63+
// leads to `NetcfgSubnetRangesOverlap` and failed deployments.
64+
// - For highest safety when using an existing VNet, supply the existing `agentSubnetPrefix` and `peSubnetPrefix`.
4865
param vnetAddressPrefix = ''
4966
param agentSubnetPrefix = ''
5067
param peSubnetPrefix = ''

0 commit comments

Comments
 (0)