burim:azure:privatetrafficprefixes
===== Question ===== How can I update the private traffic prefixes (e.g., 100.64.0.0/12) for Azure Virtual Hub Routing Intent with Terraform?
===== Answer ===== The azurerm_virtual_hub_routing_intent resource supports logical destinations like PrivateTraffic but not individual CIDR blocks. You must update these prefixes manually using Azure CLI, REST API, or azapi.
Azure CLI
bash Copy code az network vhub routing-intent update \ --name example-routing-intent \ --resource-group example-resource-group \ --vhub-name example-hub \ --set privateTrafficPrefixes="[10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 100.64.0.0/12]"
Terraform with AzAPI
terraform Copy code
resource "azapi_update_resource" "routing_intent" {
type = "Microsoft.Network/virtualHubs/routingIntent@2022-01-01"
name = "example-routing-intent"
parent_id = "/subscriptions/${data.azurerm_client_config.current.subscription_id}/resourceGroups/example-resource-group/providers/Microsoft.Network/virtualHubs/example-hub"
body = jsonencode({
properties = {
privateTrafficPrefixes = [
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
"100.64.0.0/12"
]
}
})
}
burim/azure/privatetrafficprefixes.txt · Last modified: 2025/01/14 09:32 by burim
