Skip to content

claranet/terraform-azurerm-expressroute

Repository files navigation

Azure ExpressRoute

Changelog Notice Apache V2 License TF Registry

This module creates an Azure ExpressRoute Circuit. When your Azure ExpressRoute Circuit is provisionned, you can create an Azure ExpressRoute Circuit Peering. If you configure a Private Peering Circuit, you can deploy an Azure Virtual Network Gateway.

Global versioning rule for Claranet Azure modules

Module version Terraform version AzureRM version
>= 7.x.x 1.3.x >= 3.0
>= 6.x.x 1.x >= 3.0
>= 5.x.x 0.15.x >= 2.0
>= 4.x.x 0.13.x / 0.14.x >= 2.0
>= 3.x.x 0.12.x >= 2.0
>= 2.x.x 0.12.x < 2.0
< 2.x.x 0.11.x < 2.0

Contributing

If you want to contribute to this repository, feel free to use our pre-commit git hook configuration which will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.

More details are available in the CONTRIBUTING.md file.

Usage

This module is optimized to work with the Claranet terraform-wrapper tool which set some terraform variables in the environment needed by this module. More details about variables set by the terraform-wrapper available in the documentation.

module "azure_region" {
  source  = "claranet/regions/azurerm"
  version = "x.x.x"

  azure_region = var.azure_region
}

module "rg" {
  source  = "claranet/rg/azurerm"
  version = "x.x.x"

  location    = module.azure_region.location
  client_name = var.client_name
  environment = var.environment
  stack       = var.stack
}

module "logs" {
  source  = "claranet/run/azurerm//modules/logs"
  version = "x.x.x"

  client_name    = var.client_name
  location       = module.azure_region.location
  location_short = module.azure_region.location_short
  environment    = var.environment
  stack          = var.stack

  resource_group_name = module.rg.resource_group_name
}

module "azure_virtual_network" {
  source  = "claranet/vnet/azurerm"
  version = "x.x.x"

  environment    = var.environment
  location       = module.azure_region.location
  location_short = module.azure_region.location_short
  client_name    = var.client_name
  stack          = var.stack

  resource_group_name = module.rg.resource_group_name

  vnet_cidr = ["10.10.0.0/16"]
}

module "express_route" {
  source  = "claranet/expressroute/azurerm"
  version = "x.x.x"

  environment    = var.environment
  location       = module.azure_region.location
  location_short = module.azure_region.location_short
  client_name    = var.client_name
  stack          = var.stack

  resource_group_name = module.rg.resource_group_name

  logs_destinations_ids = [
    module.logs.log_analytics_workspace_id
  ]

  service_provider_name = "Equinix"
  peering_location      = "London"
  bandwidth_in_mbps     = 50

  virtual_network_name = module.azure_virtual_network.virtual_network_name
  subnet_gateway_cidr  = ["10.10.0.0/27"]

  # Enable when the ExpressRoute Circuit status is provisioned
  express_route_circuit_peering_enabled = false
  express_route_circuit_peerings = [
    {
      peering_type                  = "AzurePrivatePeering"
      primary_peer_address_prefix   = "169.254.0.0/30"
      secondary_peer_address_prefix = "169.254.0.4/30"
      peer_asn                      = 25419
      vlan_id                       = 100
    }
  ]
}

Providers

Name Version
azurecaf ~> 1.2, >= 1.2.22
azurerm ~> 3.39

Modules

Name Source Version
express_route_circuit_diagnostic_settings claranet/diagnostic-settings/azurerm ~> 6.5.0
subnet_gateway claranet/subnet/azurerm 6.3.0

Resources

Name Type
azurerm_express_route_circuit.erc resource
azurerm_express_route_circuit_peering.ercp resource
azurerm_public_ip.public_ip resource
azurerm_virtual_network_gateway.ergw resource
azurerm_virtual_network_gateway_connection.er_gateway_connection resource
azurecaf_name.erc data source
azurecaf_name.ergw data source
azurecaf_name.ergw_connection data source
azurecaf_name.ergw_ipconfig data source
azurecaf_name.pub_ip data source

Inputs

Name Description Type Default Required
active_active_enabled Enable or disable an active-active Virtual Network Gateway. (Require a HighPerformance or an UltraPerformance SKU.) bool false no
bandwidth_in_mbps The bandwidth in Mbps of the circuit. number n/a yes
client_name Name of client. string n/a yes
custom_diagnostic_settings_name Custom name of the diagnostics settings, name will be 'default' if not set. string "default" no
custom_express_route_circuit_name Custom ExpressRoute Circuit resource name. string null no
custom_express_route_gateway_connection_name Custom ExpressRoute Gateway connection resource name. string null no
custom_express_route_gateway_ipconfig_name Custom ExpressRoute Gateway IP config name. string null no
custom_express_route_gateway_name Custom ExpressRoute gateway resource name. string null no
custom_public_ip_name Custom public IP resource name. string null no
default_tags_enabled Option to enable or disable default tags. bool true no
environment Name of application's environment. string n/a yes
express_route_circuit_extra_tags Extra tags to add for ExpressRoute Circuit resource. map(string) {} no
express_route_circuit_peering_enabled Enable or disable Express Route Circuit Peering configuration. (Should be disable at start. When the ExpressRoute circuit status is 'Provisioned', enable it.) bool n/a yes
express_route_circuit_peerings Configuration block of Private, Public and Microsoft ExpressRoute Circuit Peerings.
list(object({
peering_type = string
primary_peer_address_prefix = string
secondary_peer_address_prefix = string
peer_asn = number
vlan_id = number
shared_key = optional(string)
microsoft_peering_config = optional(object({
advertised_public_prefixes = list(string)
customer_asn = optional(number)
routing_registry_name = optional(string)
}))
}))
n/a yes
express_route_gateway_connection_extra_tags Extra tags to add for ExpressRoute Gateway connection resource. map(string) {} no
express_route_gateway_connection_route_weight The routing weight of the ExpressRoute Gateway connection. number 10 no
express_route_gateway_enabled Enable or disable creation of the Virtual Network Gateway. bool true no
express_route_gateway_extra_tags Extra tags to add for Virtual Network Gateway resource. map(string) {} no
express_route_gateway_sku SKU of the virtual network gateway resource. Possible values are here. string "Standard" no
express_route_sku ExpressRoute SKU. Possible values are here.
object({
tier = string,
family = string
})
{
"family": "MeteredData",
"tier": "Standard"
}
no
extra_tags Extra tags to add. map(string) {} no
location Azure location. string n/a yes
location_short Short string for Azure location. string n/a yes
logs_categories Log categories to send to destinations. list(string) null no
logs_destinations_ids List of destination resources IDs for logs diagnostic destination.
Can be Storage Account, Log Analytics Workspace and Event Hub. No more than one of each can be set.
If you want to specify an Azure EventHub to send logs and metrics to, you need to provide a formated string with both the EventHub Namespace authorization send ID and the EventHub name (name of the queue to use in the Namespace) separated by the `
` character. list(string) n/a
logs_metrics_categories Metrics categories to send to destinations. list(string) null no
name_prefix Optional prefix for the generated name. string "" no
name_suffix Optional suffix for the generated name. string "" no
peering_location The name of the peering location. string n/a yes
public_ip_allocation_method Defines the allocation method for this IP address. Possible values are Static or Dynamic. string "Dynamic" no
public_ip_extra_tags Extra tags to add for public IP resource. map(string) {} no
public_ip_sku SKU of public IP resource. Possible values are Basic or Standard. string "Basic" no
public_ip_zones List of availability zone for the public IP resource. list(number)
[
1,
2,
3
]
no
resource_group_name Name of the application's resource group. string n/a yes
service_provider_name The name of the ExpressRoute Service Provider. string n/a yes
stack Name of application's stack. string n/a yes
subnet_gateway_cidr The address prefix list to use for the subnet. list(string) null no
subnet_gateway_id ID of an existing subnet gateway. string null no
use_caf_naming Use the Azure CAF naming provider to generate default resource name. custom_name override this if set. Legacy default name is used if this is set to false. bool true no
virtual_network_name Virtual network name. string n/a yes

Outputs

Name Description
express_route_circuit_id The ID of the ExpressRoute circuit
express_route_circuit_name Name of the ExpressRoute circuit
express_route_circuit_service_key The string needed by the service provider to provision the ExpressRoute circuit
express_route_circuit_service_provider_provisioning_state The ExpressRoute circuit provisioning state from your chosen service provider
express_route_gateway_id ID of the ExpressRoute Gateway
express_route_peering_azure_asn ASN (Autonomous System Number) Used by Azure for BGP Peering
subnet_gateway_id ID of the Gateway Subnet ID

Related documentation

Microsoft Azure documentation : docs.microsoft.com/fr-fr/azure/expressroute/