Skip to content

azurermVirtualHubConnection

Manages a Connection for a Virtual Hub.

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 azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
  this,
  "example_1",
  {
    address_space: ["172.0.0.0/16"],
    location: azurermResourceGroupExample.location,
    name: "example-network",
    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.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const azurermVirtualWanExample = new azurerm.virtualWan.VirtualWan(
  this,
  "example_2",
  {
    location: azurermResourceGroupExample.location,
    name: "example-vwan",
    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_3",
  {
    address_prefix: "10.0.1.0/24",
    location: azurermResourceGroupExample.location,
    name: "example-hub",
    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");
const azurermVirtualHubConnectionExample =
  new azurerm.virtualHubConnection.VirtualHubConnection(this, "example_4", {
    name: "example-vhub",
    remote_virtual_network_id: azurermVirtualNetworkExample.id,
    virtual_hub_id: azurermVirtualHubExample.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.*/
azurermVirtualHubConnectionExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) The Name which should be used for this Connection, which must be unique within the Virtual Hub. Changing this forces a new resource to be created.

  • virtualHubId - (Required) The ID of the Virtual Hub within which this connection should be created. Changing this forces a new resource to be created.

  • remoteVirtualNetworkId - (Required) The ID of the Virtual Network which the Virtual Hub should be connected to. Changing this forces a new resource to be created.


  • internetSecurityEnabled - (Optional) Should Internet Security be enabled to secure internet traffic? Defaults to false.

  • routing - (Optional) A routing block as defined below.


A routing block supports the following:

  • associatedRouteTableId - (Optional) The ID of the route table associated with this Virtual Hub connection.

  • propagatedRouteTable - (Optional) A propagatedRouteTable block as defined below.

  • staticVnetRoute - (Optional) A staticVnetRoute block as defined below.


A propagatedRouteTable block supports the following:

  • labels - (Optional) The list of labels to assign to this route table.

  • routeTableIds - (Optional) A list of Route Table IDs to associated with this Virtual Hub Connection.


A staticVnetRoute block supports the following:

  • name - (Optional) The name which should be used for this Static Route.

  • addressPrefixes - (Optional) A list of CIDR Ranges which should be used as Address Prefixes.

  • nextHopIpAddress - (Optional) The IP Address which should be used for the Next Hop.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Virtual Hub Connection.

Timeouts

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

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

Import

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

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