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_operations
optional - bool -
bandwidth_in_mbps
required - number -
id
optional computed - string -
location
required - string -
name
required - string -
peering_location
required - string -
resource_group_name
required - string -
service_key
optional computed - string -
service_provider_name
required - string -
service_provider_provisioning_state
optional computed - string -
tags
optional - map from string to string -
sku
list block -
timeouts
single 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
name
required - stringtype
required - stringapiVersion
required - stringlocation
required - stringResource location.
tags
optional - stringResource tags.
sku
optionalname
optional - stringThe name of the SKU.
tier
optional - stringThe tier of the SKU.
family
optional - stringThe family of the SKU.
properties
requiredallowClassicOperations
optional - booleanAllow classic operations.
authorizations
optional arrayproperties
optionalname
optional - stringThe name of the resource that is unique within a resource group. This name can be used to access the resource.
peerings
optional arrayproperties
optionalpeeringType
optional - stringThe peering type.
state
optional - stringThe peering state.
peerASN
optional - integerThe peer ASN.
primaryPeerAddressPrefix
optional - stringThe primary address prefix.
secondaryPeerAddressPrefix
optional - stringThe secondary address prefix.
sharedKey
optional - stringThe shared key.
vlanId
optional - integerThe VLAN ID.
microsoftPeeringConfig
optionaladvertisedPublicPrefixes
optional - arrayThe reference to AdvertisedPublicPrefixes.
advertisedCommunities
optional - arrayThe communities of bgp peering. Specified for microsoft peering.
legacyMode
optional - integerThe legacy mode of the peering.
customerASN
optional - integerThe CustomerASN of the peering.
routingRegistryName
optional - stringThe RoutingRegistryName of the configuration.
stats
optionalprimarybytesIn
optional - integerThe Primary BytesIn of the peering.
primarybytesOut
optional - integerThe primary BytesOut of the peering.
secondarybytesIn
optional - integerThe secondary BytesIn of the peering.
secondarybytesOut
optional - integerThe secondary BytesOut of the peering.
gatewayManagerEtag
optional - stringThe GatewayManager Etag.
routeFilter
optionalid
required - stringResource ID.
ipv6PeeringConfig
optionalprimaryPeerAddressPrefix
optional - stringThe primary address prefix.
secondaryPeerAddressPrefix
optional - stringThe secondary address prefix.
microsoftPeeringConfig
optionaladvertisedPublicPrefixes
optional - arrayThe reference to AdvertisedPublicPrefixes.
advertisedCommunities
optional - arrayThe communities of bgp peering. Specified for microsoft peering.
legacyMode
optional - integerThe legacy mode of the peering.
customerASN
optional - integerThe CustomerASN of the peering.
routingRegistryName
optional - stringThe RoutingRegistryName of the configuration.
routeFilter
optionalid
required - stringResource ID.
state
optional - stringThe state of peering.
expressRouteConnection
optionalid
required - stringResource ID.
name
optional - stringThe name of the resource that is unique within a resource group. This name can be used to access the resource.
serviceProviderNotes
optional - stringThe ServiceProviderNotes.
serviceProviderProperties
optionalserviceProviderName
optional - stringThe serviceProviderName.
peeringLocation
optional - stringThe peering location.
bandwidthInMbps
optional - integerThe BandwidthInMbps.
expressRoutePort
optionalid
required - stringResource ID.
bandwidthInGbps
optional - numberThe bandwidth of the circuit when the circuit is provisioned on an ExpressRoutePort resource.
gatewayManagerEtag
optional - 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.