Skip to content

azurermVirtualHub

Manages a Virtual Hub within a Virtual WAN.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermVirtualWanExample = new azurerm.virtualWan.VirtualWan(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "example-virtualwan",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualWanExample.overrideLogicalId("example");
const azurermVirtualHubExample = new azurerm.virtualHub.VirtualHub(
  this,
  "example_2",
  {
    address_prefix: "10.0.0.0/23",
    location: azurermResourceGroupExample.location,
    name: "example-virtualhub",
    resource_group_name: azurermResourceGroupExample.name,
    virtual_wan_id: azurermVirtualWanExample.id,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualHubExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the Virtual Hub. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) Specifies the name of the Resource Group where the Virtual Hub should exist. Changing this forces a new resource to be created.

  • location - (Required) Specifies the supported Azure location where the Virtual Hub should exist. Changing this forces a new resource to be created.


  • addressPrefix - (Optional) The Address Prefix which should be used for this Virtual Hub. Changing this forces a new resource to be created. The address prefix subnet cannot be smaller than a /24. Azure recommends using a /23.

  • hubRoutingPreference - (Optional) The hub routing preference. Possible values are expressRoute, asPath and vpnGateway. Defaults to expressRoute.

  • route - (Optional) One or more route blocks as defined below.

  • sku - (Optional) The SKU of the Virtual Hub. Possible values are basic and standard. Changing this forces a new resource to be created.

  • virtualWanId - (Optional) The ID of a Virtual WAN within which the Virtual Hub should be created. Changing this forces a new resource to be created.

  • tags - (Optional) A mapping of tags to assign to the Virtual Hub.


The route block supports the following:

  • addressPrefixes - (Required) A list of Address Prefixes.

  • nextHopIpAddress - (Required) The IP Address that Packets should be forwarded to as the Next Hop.


Attributes Reference

The following attributes are exported:

  • id - The ID of the Virtual Hub.

  • defaultRouteTableId - The ID of the default Route Table in the Virtual Hub.

  • virtualRouterAsn - The Autonomous System Number of the Virtual Hub BGP router.

  • virtualRouterIps - The IP addresses of the Virtual Hub BGP router.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 60 minutes) Used when creating the Virtual Hub.
  • update - (Defaults to 60 minutes) Used when updating the Virtual Hub.
  • read - (Defaults to 5 minutes) Used when retrieving the Virtual Hub.
  • delete - (Defaults to 60 minutes) Used when deleting the Virtual Hub.

Import

Virtual Hub's can be imported using the resourceId, e.g.

terraform import azurerm_virtual_hub.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/virtualHubs/hub1