Skip to content

azurermVirtualHubBgpConnection

Manages a Bgp 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 azurermVirtualHubExample = new azurerm.virtualHub.VirtualHub(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "example-vhub",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
  }
);
/*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 azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
  this,
  "example_2",
  {
    address_space: ["10.5.0.0/16"],
    location: azurermResourceGroupExample.location,
    name: "example-vnet",
    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 azurermPublicIpExample = new azurerm.publicIp.PublicIp(
  this,
  "example_3",
  {
    allocation_method: "Static",
    location: azurermResourceGroupExample.location,
    name: "example-pip",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "Standard",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPublicIpExample.overrideLogicalId("example");
const azurermSubnetExample = new azurerm.subnet.Subnet(this, "example_4", {
  address_prefixes: ["10.5.1.0/24"],
  name: "RouteServerSubnet",
  resource_group_name: azurermResourceGroupExample.name,
  virtual_network_name: azurermVirtualNetworkExample.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.*/
azurermSubnetExample.overrideLogicalId("example");
const azurermVirtualHubIpExample = new azurerm.virtualHubIp.VirtualHubIp(
  this,
  "example_5",
  {
    name: "example-vhubip",
    private_ip_address: "10.5.1.18",
    private_ip_allocation_method: "Static",
    public_ip_address_id: azurermPublicIpExample.id,
    subnet_id: azurermSubnetExample.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.*/
azurermVirtualHubIpExample.overrideLogicalId("example");
const azurermVirtualHubBgpConnectionExample =
  new azurerm.virtualHubBgpConnection.VirtualHubBgpConnection(
    this,
    "example_6",
    {
      depends_on: [`\${${azurermVirtualHubIpExample.fqn}}`],
      name: "example-vhub-bgpconnection",
      peer_asn: 65514,
      peer_ip: "169.254.21.5",
      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.*/
azurermVirtualHubBgpConnectionExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • name - (Required) The name which should be used for this Virtual Hub Bgp Connection. Changing this forces a new resource to be created.

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

  • peerAsn - (Required) The peer autonomous system number for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.

  • peerIp - (Required) The peer IP address for the Virtual Hub Bgp Connection. Changing this forces a new resource to be created.

  • virtualNetworkConnectionId - (Optional) The ID of virtual network connection.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Virtual Hub Bgp Connection.

Timeouts

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

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

Import

Virtual Hub Bgp Connections can be imported using the resourceId, e.g.

terraform import azurerm_virtual_hub_bgp_connection.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/virtualHubs/virtualHub1/bgpConnections/connection1