Skip to content

jsathler/terraform-azurerm-vnet-peering

Repository files navigation

Azure Virtual Network Peering Terraform module

Terraform module which creates Azure Virtual Network Peering on Azure.

Supported Azure services:

Additional information

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"

Requirements

Name Version
terraform >= 1.5.6
azurerm >= 3.70.0

Providers

Name Version
azurerm.local-vnet >= 3.70.0
azurerm.remote-vnet >= 3.70.0

Resources

Name Type
azurerm_virtual_network_peering.local resource
azurerm_virtual_network_peering.remote resource

Inputs

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({
vnet_id = string
peering_name = optional(string, null)
allow_virtual_network_access = optional(bool, true)
allow_forwarded_traffic = optional(bool, false)
allow_gateway_transit = optional(bool, false)
use_remote_gateways = optional(bool, true)
})
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({
vnet_id = string
peering_name = optional(string, null)
allow_virtual_network_access = optional(bool, true)
allow_forwarded_traffic = optional(bool, false)
allow_gateway_transit = optional(bool, true)
use_remote_gateways = optional(bool, false)
})
n/a yes

Outputs

Name Description
local_peering_name Peering name on local vnet
remote_peering_name Peering name on remote vnet

Examples

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages