Skip to content

azurermExpressRouteCircuitPeering

Manages an ExpressRoute Circuit Peering.

Example Usage (Creating a Microsoft Peering)

/*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: "exprtTest",
  }
);
const azurermExpressRouteCircuitExample =
  new azurerm.expressRouteCircuit.ExpressRouteCircuit(this, "example_1", {
    allow_classic_operations: false,
    bandwidth_in_mbps: 50,
    location: azurermResourceGroupExample.location,
    name: "expressRoute1",
    peering_location: "Silicon Valley",
    resource_group_name: azurermResourceGroupExample.name,
    service_provider_name: "Equinix",
    sku: [
      {
        family: "MeteredData",
        tier: "Standard",
      },
    ],
    tags: {
      environment: "Production",
    },
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermExpressRouteCircuitExample.overrideLogicalId("example");
const azurermExpressRouteCircuitPeeringExample =
  new azurerm.expressRouteCircuitPeering.ExpressRouteCircuitPeering(
    this,
    "example_2",
    {
      express_route_circuit_name: azurermExpressRouteCircuitExample.name,
      ipv4_enabled: true,
      ipv6: [
        {
          enabled: true,
          microsoft_peering: [
            {
              advertised_public_prefixes: ["2002:db01::/126"],
            },
          ],
          primary_peer_address_prefix: "2002:db01::/126",
          secondary_peer_address_prefix: "2003:db01::/126",
        },
      ],
      microsoft_peering_config: [
        {
          advertised_public_prefixes: ["123.1.0.0/24"],
        },
      ],
      peer_asn: 100,
      peering_type: "MicrosoftPeering",
      primary_peer_address_prefix: "123.0.0.0/30",
      resource_group_name: azurermResourceGroupExample.name,
      secondary_peer_address_prefix: "123.0.0.4/30",
      vlan_id: 300,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermExpressRouteCircuitPeeringExample.overrideLogicalId("example");

Example Usage (Creating Azure Private Peering)

/*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: "exprtTest",
  }
);
const azurermExpressRouteCircuitExample =
  new azurerm.expressRouteCircuit.ExpressRouteCircuit(this, "example_1", {
    allow_classic_operations: false,
    bandwidth_in_mbps: 50,
    location: azurermResourceGroupExample.location,
    name: "expressRoute1",
    peering_location: "Silicon Valley",
    resource_group_name: azurermResourceGroupExample.name,
    service_provider_name: "Equinix",
    sku: [
      {
        family: "MeteredData",
        tier: "Standard",
      },
    ],
    tags: {
      environment: "Production",
    },
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermExpressRouteCircuitExample.overrideLogicalId("example");
const azurermExpressRouteCircuitPeeringExample =
  new azurerm.expressRouteCircuitPeering.ExpressRouteCircuitPeering(
    this,
    "example_2",
    {
      express_route_circuit_name: azurermExpressRouteCircuitExample.name,
      ipv4_enabled: true,
      ipv6: [
        {
          enabled: true,
          primary_peer_address_prefix: "2002:db01::/126",
          secondary_peer_address_prefix: "2003:db01::/126",
        },
      ],
      peer_asn: 100,
      peering_type: "AzurePrivatePeering",
      primary_peer_address_prefix: "123.0.0.0/30",
      resource_group_name: azurermResourceGroupExample.name,
      secondary_peer_address_prefix: "123.0.0.4/30",
      vlan_id: 300,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermExpressRouteCircuitPeeringExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • peeringType - (Required) The type of the ExpressRoute Circuit Peering. Acceptable values include azurePrivatePeering, azurePublicPeering and microsoftPeering.

\~> NOTE: only one Peering of each Type can be created. Attempting to create multiple peerings of the same type will overwrite the original peering.

  • expressRouteCircuitName - (Required) The name of the ExpressRoute Circuit in which to create the Peering. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which to create the Express Route Circuit Peering. Changing this forces a new resource to be created.

  • vlanId - (Required) A valid VLAN ID to establish this peering on.

  • primaryPeerAddressPrefix - (Optional) A /30 subnet for the primary link. Required when config for IPv4.

  • secondaryPeerAddressPrefix - (Optional) A /30 subnet for the secondary link. Required when config for IPv4.

  • ipv4Enabled - (Optional) A boolean value indicating whether the IPv4 peering is enabled. Defaults to true.

  • sharedKey - (Optional) The shared key. Can be a maximum of 25 characters.

  • peerAsn - (Optional) The Either a 16-bit or a 32-bit ASN. Can either be public or private.

  • microsoftPeeringConfig - (Optional) A microsoftPeeringConfig block as defined below. Required when peeringType is set to microsoftPeering and config for IPv4.

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

  • routeFilterId - (Optional) The ID of the Route Filter. Only available when peeringType is set to microsoftPeering.


A microsoftPeeringConfig block contains:

  • advertisedPublicPrefixes - (Required) A list of Advertised Public Prefixes.

  • customerAsn - (Optional) The CustomerASN of the peering. Defaults to 0.

  • routingRegistryName - (Optional) The Routing Registry against which the AS number and prefixes are registered. For example: arin, ripe, afrinic etc. Defaults to none.

  • advertisedCommunities - (Optional) The communities of Bgp Peering specified for microsoft peering.


A ipv6 block contains:

  • primaryPeerAddressPrefix - (Required) A subnet for the primary link.

  • secondaryPeerAddressPrefix - (Required) A subnet for the secondary link.

  • enabled - (Optional) A boolean value indicating whether the IPv6 peering is enabled. Defaults to true.

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

  • routeFilterId - (Optional) The ID of the Route Filter. Only available when peeringType is set to microsoftPeering.

\~> NOTE: ipv6 can be specified when peeringType is microsoftPeering or azurePrivatePeering


A microsoftPeering block contains:

  • advertisedPublicPrefixes - (Optional) A list of Advertised Public Prefixes.

  • customerAsn - (Optional) The CustomerASN of the peering. Defaults to 0.

  • routingRegistryName - (Optional) The Routing Registry against which the AS number and prefixes are registered. For example: arin, ripe, afrinic etc. Defaults to none.

  • advertisedCommunities - (Optional) The communities of Bgp Peering specified for microsoft peering.

Attributes Reference

The following attributes are exported:

  • id - The ID of the ExpressRoute Circuit Peering.

  • azureAsn - The ASN used by Azure.

  • primaryAzurePort - The Primary Port used by Azure for this Peering.

  • secondaryAzurePort - The Secondary Port used by Azure for this Peering.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the ExpressRoute Circuit Peering.

  • update - (Defaults to 30 minutes) Used when updating the ExpressRoute Circuit Peering.

  • read - (Defaults to 5 minutes) Used when retrieving the ExpressRoute Circuit Peering.

  • delete - (Defaults to 30 minutes) Used when deleting the ExpressRoute Circuit Peering.

Import

ExpressRoute Circuit Peerings can be imported using the resourceId, e.g.

terraform import azurerm_express_route_circuit_peering.peering1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/expressRouteCircuits/myExpressRoute/peerings/peering1