Azure Network BGP Connection
This page shows how to write Terraform and Azure Resource Manager for Network BGP Connection and write them securely.
azurerm_virtual_hub_bgp_connection (Terraform)
The BGP Connection in Network can be configured in Terraform with the resource name azurerm_virtual_hub_bgp_connection
. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_virtual_hub_bgp_connection" "bgp_con" {
depends_on = [azurerm_virtual_hub_ip.hub_ip]
for_each = try(var.virtual_hub_config.bgp_connection, {})
name = azurecaf_name.bgp_con[each.key].result
virtual_hub_id = azurerm_virtual_hub.vwan_hub.id
resource "azurerm_virtual_hub_bgp_connection" "bgp_con" {
depends_on = [azurerm_virtual_hub_ip.hub_ip]
for_each = try(var.virtual_hub_config.bgp_connection, {})
name = azurecaf_name.bgp_con[each.key].result
virtual_hub_id = azurerm_virtual_hub.vwan_hub.id
resource "azurerm_virtual_hub_bgp_connection" "bgp_con" {
depends_on = [azurerm_virtual_hub_ip.hub_ip]
for_each = try(var.virtual_hub_config.bgp_connection, {})
name = azurecaf_name.bgp_con[each.key].result
virtual_hub_id = azurerm_virtual_hub.vwan_hub.id
resource "azurerm_virtual_hub_bgp_connection" "bgp_con" {
depends_on = [azurerm_virtual_hub_ip.hub_ip]
for_each = try(var.virtual_hub_config.bgp_connection, {})
name = azurecaf_name.bgp_con[each.key].result
virtual_hub_id = azurerm_virtual_hub.vwan_hub.id
Parameters
-
id
optional computed - string -
name
required - string -
peer_asn
required - number -
peer_ip
required - string -
virtual_hub_id
required - string -
timeouts
single block
Explanation in Terraform Registry
Manages a Bgp Connection for a Virtual Hub.
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/virtualHubs/bgpConnections (Azure Resource Manager)
The virtualHubs/bgpConnections in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/virtualHubs/bgpConnections
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
name
required - stringtype
required - stringapiVersion
required - stringproperties
requiredpeerAsn
optional - integerPeer ASN.
peerIp
optional - stringPeer IP.
Frequently asked questions
What is Azure Network BGP Connection?
Azure Network BGP Connection 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 BGP Connection?
For Terraform, the aztfmod/terraform-azurerm-caf, pkhuntia/aztfmod and anmoltoppo/Terraform source code examples are useful. See the Terraform Example section for further details.