Terraform module which creates Azure Virtual Network Peering on Azure.
Supported Azure services:
Since this module can create peering between two vnets in different subscriptions, you should provide the "providers" block as bellow.
If both vnets are in same subscription, use the same provider configuration for both "azurerm.local-vnet" and "azurerm.remote-vnet"
Name | Version |
---|---|
terraform | >= 1.5.6 |
azurerm | >= 3.70.0 |
Name | Version |
---|---|
azurerm.local-vnet | >= 3.70.0 |
azurerm.remote-vnet | >= 3.70.0 |
Name | Type |
---|---|
azurerm_virtual_network_peering.local | resource |
azurerm_virtual_network_peering.remote | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
local_vnet | Local vNet parameters. This parameter is required - vnet_id: (required) The full Azure resource ID of the remote virtual network - peering_name: (optional) If not defined, the vnet name will be used in the peering name - allow_virtual_network_access: (optional) Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to true - allow_forwarded_traffic: (optional) Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false - allow_gateway_transit: (optional) Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to false - use_remote_gateways: (optional) Controls if remote gateways can be used on the local virtual network. Defaults to true |
object({ |
n/a | yes |
remote_vnet | Remote vNet parameters. This parameter is required - vnet_id: (required) The full Azure resource ID of the remote virtual network - peering_name: (optional) If not defined, the vnet name will be used in the peering name - allow_virtual_network_access: (optional) Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to true - allow_forwarded_traffic: (optional) Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false - allow_gateway_transit: (optional) Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. Defaults to true - use_remote_gateways: (optional) Controls if remote gateways can be used on the local virtual network. Defaults to false |
object({ |
n/a | yes |
Name | Description |
---|---|
local_peering_name | Peering name on local vnet |
remote_peering_name | Peering name on remote vnet |
module "devtest-hub-peering" {
source = "jsathler/vnet-peering/azurerm"
providers = {
azurerm.local-vnet = azurerm.devtest
azurerm.remote-vnet = azurerm
}
local_vnet = { vnet_id = module.devtest-vnet.vnet_id, use_remote_gateways = false }
remote_vnet = { vnet_id = module.hub-vnet.vnet_id, allow_gateway_transit = false }
}
More examples in ./examples folder