Azure Network Circuit
This page shows how to write Terraform and Azure Resource Manager for Network Circuit and write them securely.
azurerm_express_route_circuit (Terraform)
The Circuit in Network can be configured in Terraform with the resource name azurerm_express_route_circuit. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_express_route_circuit" "example" {
name = "expressRoute1"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
service_provider_name = "Equinix"
peering_location = "Silicon Valley"
resource "azurerm_express_route_circuit" "express_route" {
name = var.name
location = var.location
resource_group_name = var.rg_name
bandwidth_in_mbps = var.bandwidth
service_provider_name = var.provider_name
resource "azurerm_express_route_circuit" "myterraformexpressroute" {
name = var.express_route_name
location = var.express_route_location
resource_group_name = var.express_route_resource_group_name
service_provider_name = var.express_route_service_provider_name
peering_location = var.express_route_peering_location
resource "azurerm_express_route_circuit" "cloudlab" {
name = var.exrcircuit_name
resource_group_name = azurerm_resource_group.cloudlab.name
location = azurerm_resource_group.cloudlab.location
service_provider_name = var.exrcircuit_provider
peering_location = var.exrcircuit_location
resource "azurerm_express_route_circuit" "poc-frankfurt" {
name = "Equiniq-POC-Frankfurt"
resource_group_name = var.rg_name
location = var.location
service_provider_name = var.service_provider_name
peering_location = var.peering_location
resource "azurerm_express_route_circuit" "cloudN" {
name = "cloudN-ExpressRoute"
resource_group_name = "s5-vnet-rg-01"
location = "West US"
service_provider_name = "Equinix"
peering_location = "Silicon Valley"
resource "azurerm_express_route_circuit" "circuit" {
name = azurecaf_name.circuit.result
resource_group_name = var.resource_group_name
location = var.location
tags = local.tags
resource "azurerm_express_route_circuit" "circuit" {
name = azurecaf_name.circuit.result
resource_group_name = var.resource_group_name
location = var.location
tags = local.tags
resource "azurerm_express_route_circuit" "circuit" {
name = azurecaf_name.circuit.result
resource_group_name = var.resource_group_name
location = var.location
tags = local.tags
resource "azurerm_express_route_circuit" "express_route" {
name = var.express_route.name
resource_group_name = var.resource_group.name
location = var.resource_group.location
service_provider_name = var.express_route.service_provider_name
peering_location = var.express_route.peering_location
Parameters
-
allow_classic_operationsoptional - bool -
bandwidth_in_mbpsrequired - number -
idoptional computed - string -
locationrequired - string -
namerequired - string -
peering_locationrequired - string -
resource_group_namerequired - string -
service_keyoptional computed - string -
service_provider_namerequired - string -
service_provider_provisioning_stateoptional computed - string -
tagsoptional - map from string to string -
skulist block -
timeoutssingle block
Explanation in Terraform Registry
Manages an ExpressRoute circuit.
Tips: Best Practices for The Other Azure Network Resources
In addition to the azurerm_network_security_group, Azure Network has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_network_security_group
Ensure to disable RDP port from the Internet
It is better to disable the RDP port from the Internet. RDP access should not be accepted from the Internet (*, 0.0.0.0, /0, internet, any), and consider using the Azure Bastion Service.
azurerm_network_security_rule
Ensure to set a more restrictive CIDR range for ingress from the internet
It is better to set a more restrictive CIDR range not to use very broad subnets. If possible, segments should be divided into smaller subnets.
azurerm_network_watcher_flow_log
Ensure to enable Retention policy for flow logs and set it to enough duration
It is better to enable a retention policy for flow logs. Flow logs show us all network activity in the cloud environment and support us when we face critical incidents.
Microsoft.Network/expressRouteCircuits (Azure Resource Manager)
The expressRouteCircuits in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/expressRouteCircuits. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"type": "Microsoft.Network/expressRouteCircuits",
"circuitName": "expressRouteCircuit1",
"parameters": {
"location": "westus",
"sku": {
"name": "Premium_MeteredData",
"type": "Microsoft.Network/expressRouteCircuits",
"circuitName": "expressRouteCircuit1",
"parameters": {
"location": "westus",
"sku": {
"name": "Premium_MeteredData",
"type": "Microsoft.Network/expressRouteCircuits",
"circuitName": "expressRouteCircuit1",
"parameters": {
"location": "westus",
"sku": {
"name": "Premium_MeteredData",
"type": "Microsoft.Network/expressRouteCircuits",
"circuitName": "expressRouteCircuit1",
"parameters": {
"location": "westus",
"sku": {
"name": "Premium_MeteredData",
"type": "Microsoft.Network/expressRouteCircuits",
"circuitName": "expressRouteCircuit1",
"parameters": {
"location": "westus",
"sku": {
"name": "Premium_MeteredData",
"type": "Microsoft.Network/expressRouteCircuits",
"circuitName": "expressRouteCircuit1",
"parameters": {
"location": "westus",
"sku": {
"name": "Premium_MeteredData",
"type": "Microsoft.Network/expressRouteCircuits",
"location": "westus",
"properties": {
"provisioningState": "Succeeded",
"peerings": [],
"authorizations": [],
"type": "Microsoft.Network/expressRouteCircuits",
"location": "westus",
"properties": {
"provisioningState": "Succeeded",
"peerings": [],
"authorizations": [],
"type": "Microsoft.Network/expressRouteCircuits",
"circuitName": "expressRouteCircuit1",
"parameters": {
"location": "westus",
"sku": {
"name": "Premium_MeteredData",
"type": "Microsoft.Network/expressRouteCircuits",
"circuitName": "expressRouteCircuit1",
"parameters": {
"location": "westus",
"sku": {
"name": "Premium_MeteredData",
Parameters
namerequired - stringtyperequired - stringapiVersionrequired - stringlocationrequired - stringResource location.
tagsoptional - stringResource tags.
skuoptionalnameoptional - stringThe name of the SKU.
tieroptional - stringThe tier of the SKU.
familyoptional - stringThe family of the SKU.
propertiesrequiredallowClassicOperationsoptional - booleanAllow classic operations.
authorizationsoptional arraypropertiesoptionalnameoptional - stringThe name of the resource that is unique within a resource group. This name can be used to access the resource.
peeringsoptional arraypropertiesoptionalpeeringTypeoptional - stringThe peering type.
stateoptional - stringThe peering state.
peerASNoptional - integerThe peer ASN.
primaryPeerAddressPrefixoptional - stringThe primary address prefix.
secondaryPeerAddressPrefixoptional - stringThe secondary address prefix.
sharedKeyoptional - stringThe shared key.
vlanIdoptional - integerThe VLAN ID.
microsoftPeeringConfigoptionaladvertisedPublicPrefixesoptional - arrayThe reference to AdvertisedPublicPrefixes.
advertisedCommunitiesoptional - arrayThe communities of bgp peering. Specified for microsoft peering.
legacyModeoptional - integerThe legacy mode of the peering.
customerASNoptional - integerThe CustomerASN of the peering.
routingRegistryNameoptional - stringThe RoutingRegistryName of the configuration.
statsoptionalprimarybytesInoptional - integerThe Primary BytesIn of the peering.
primarybytesOutoptional - integerThe primary BytesOut of the peering.
secondarybytesInoptional - integerThe secondary BytesIn of the peering.
secondarybytesOutoptional - integerThe secondary BytesOut of the peering.
gatewayManagerEtagoptional - stringThe GatewayManager Etag.
routeFilteroptionalidrequired - stringResource ID.
ipv6PeeringConfigoptionalprimaryPeerAddressPrefixoptional - stringThe primary address prefix.
secondaryPeerAddressPrefixoptional - stringThe secondary address prefix.
microsoftPeeringConfigoptionaladvertisedPublicPrefixesoptional - arrayThe reference to AdvertisedPublicPrefixes.
advertisedCommunitiesoptional - arrayThe communities of bgp peering. Specified for microsoft peering.
legacyModeoptional - integerThe legacy mode of the peering.
customerASNoptional - integerThe CustomerASN of the peering.
routingRegistryNameoptional - stringThe RoutingRegistryName of the configuration.
routeFilteroptionalidrequired - stringResource ID.
stateoptional - stringThe state of peering.
expressRouteConnectionoptionalidrequired - stringResource ID.
nameoptional - stringThe name of the resource that is unique within a resource group. This name can be used to access the resource.
serviceProviderNotesoptional - stringThe ServiceProviderNotes.
serviceProviderPropertiesoptionalserviceProviderNameoptional - stringThe serviceProviderName.
peeringLocationoptional - stringThe peering location.
bandwidthInMbpsoptional - integerThe BandwidthInMbps.
expressRoutePortoptionalidrequired - stringResource ID.
bandwidthInGbpsoptional - numberThe bandwidth of the circuit when the circuit is provisioned on an ExpressRoutePort resource.
gatewayManagerEtagoptional - stringThe GatewayManager Etag.
Frequently asked questions
What is Azure Network Circuit?
Azure Network Circuit is a resource for Network of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Network Circuit?
For Terraform, the dmaxim/wimc-net, mgsj2006/azurerm-module-express-route and parmeet12singh/terraform_scripts source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the shawns1/shawns1CI, shawns1/shawns1CI and assing/alerts-extension source code examples are useful. See the Azure Resource Manager Example section for further details.