Skip to content

Instantly share code, notes, and snippets.

@geekzter
Created May 2, 2021 08:48
Show Gist options
  • Save geekzter/13729013b60acbdfeb31955404798d6d to your computer and use it in GitHub Desktop.
Save geekzter/13729013b60acbdfeb31955404798d6d to your computer and use it in GitHub Desktop.
Generate random CIDR
# Set random CIDR (to reduce the risk of clashing VNet peerings with agent VNet)
$env:TF_VAR_address_space ??= "$([IPAddress]::Parse([String] (167772160 + (65536*(Get-Random -Minimum 0 -Maximum 255 -SetSeed $(Build.BuildId))))) | Select-Object -ExpandProperty IPAddressToString)/16"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment