GithubHelp home page GithubHelp logo

onlykumarabhishek / terraform-azurerm-vnet-peering Goto Github PK

View Code? Open in Web Editor NEW

This project forked from claranet/terraform-azurerm-vnet-peering

0.0 0.0 0.0 72 KB

Terraform module for Azure virtual networks peering

License: Apache License 2.0

HCL 100.00%

terraform-azurerm-vnet-peering's Introduction

Azure Virtual Network Peering

Changelog Notice Apache V2 License TF Registry

Terraform module to generate a Virtual Network Peering between two Virtual Networks which can belong to two different Azure Subscriptions.

Limitations

  • Peering between two virtual networks in different tenants isn't possible.

Version compatibility

Module version Terraform version AzureRM version
>= 5.x.x 0.15.x, 1.0.x >= 2.0
>= 4.x.x 0.13.x, 0.14.x >= 2.0
>= 3.x.x 0.12.x >= 2.0
>= 2.x.x 0.12.x < 2.0
< 2.x.x 0.11.x < 2.0

Naming

Resource naming is based on the Microsoft CAF naming convention best practices. Legacy naming is available by setting the parameter use_caf_naming to false. We rely on the official Terraform Azure CAF naming provider to generate resource names.

Resource generated CAF name by default: vpeer-{VNET Source name}-to-{VNET Destination name}

Usage

This module is optimized to work with the Claranet terraform-wrapper tool which set some terraform variables in the environment needed by this module. More details about variables set by the terraform-wrapper available in the documentation.

provider "azurerm" {
  alias           = "dst"
  subscription_id = var.azure_subscription_id
  tenant_id       = var.azure_tenant_id

  features {}
}
provider "azurerm" {
  alias           = "src"
  subscription_id = var.azure_subscription_id
  tenant_id       = var.azure_tenant_id

  features {}
}

module "azure-region" {
  source  = "claranet/regions/azurerm"
  version = "x.x.x"

  azure_region = var.azure_region
}

module "rg" {
  source  = "claranet/rg/azurerm"
  version = "x.x.x"

  location    = module.azure-region.location
  client_name = var.client_name
  environment = var.environment
  stack       = var.stack
}

module "azure-virtual-network" {
  source  = "claranet/vnet/azurerm"
  version = "x.x.x"

  environment    = var.environment
  location       = module.azure-region.location
  location_short = module.azure-region.location_short
  client_name    = var.client_name
  stack          = var.stack

  resource_group_name = module.rg.resource_group_name

  custom_vnet_name = var.custom_vnet_name
  vnet_cidr        = ["10.10.0.0/16"]
  dns_servers      = ["10.0.0.4", "10.0.0.5"] # Can be empty if not used
}

module "azure-vnet-peering" {
  source  = "claranet/vnet-peering/azurerm"
  version = "x.x.x"

  providers = {
    azurerm.src = azurerm.src
    azurerm.dst = azurerm.dst
  }

  vnet_src_id  = module.azure-virtual-network.virtual_network_id
  vnet_dest_id = data.terraform_remote_state.destination_infra.virtual_network_id

  allow_forwarded_src_traffic = true
  allow_forwarded_dst_traffic = true

  allow_virtual_src_network_access  = true
  allow_virtual_dest_network_access = true
}

Providers

Name Version
azurecaf ~> 1.1
azurerm.dst >= 2.0
azurerm.src >= 2.0

Inputs

Name Description Type Default Required
allow_forwarded_dest_traffic Option allow_forwarded_traffic for the dest vnet to peer. Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false. https://www.terraform.io/docs/providers/azurerm/r/virtual_network_peering.html#allow_forwarded_traffic bool false no
allow_forwarded_src_traffic Option allow_forwarded_traffic for the src vnet to peer. Controls if forwarded traffic from VMs in the remote virtual network is allowed. Defaults to false. https://www.terraform.io/docs/providers/azurerm/r/virtual_network_peering.html#allow_forwarded_traffic bool false no
allow_gateway_dest_transit Option allow_gateway_transit for the dest vnet to peer. Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. https://www.terraform.io/docs/providers/azurerm/r/virtual_network_peering.html#allow_gateway_transit bool false no
allow_gateway_src_transit Option allow_gateway_transit for the src vnet to peer. Controls gatewayLinks can be used in the remote virtual network’s link to the local virtual network. https://www.terraform.io/docs/providers/azurerm/r/virtual_network_peering.html#allow_gateway_transit bool false no
allow_virtual_dest_network_access Option allow_virtual_network_access for the dest vnet to peer. Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to false. https://www.terraform.io/docs/providers/azurerm/r/virtual_network_peering.html#allow_virtual_network_access bool false no
allow_virtual_src_network_access Option allow_virtual_network_access for the src vnet to peer. Controls if the VMs in the remote virtual network can access VMs in the local virtual network. Defaults to false. https://www.terraform.io/docs/providers/azurerm/r/virtual_network_peering.html#allow_virtual_network_access bool false no
custom_peering_dst_name Custom name of the vnet peerings to create string "" no
custom_peering_src_name Custom name of the vnet peerings to create string "" no
name_prefix Optional prefix for the generated name string "" no
name_suffix Optional suffix for the generated name string "to" no
use_caf_naming Use the Azure CAF naming provider to generate default resource name. custom_rg_name override this if set. Legacy default name is used if this is set to false. bool true no
use_remote_dest_gateway Option use_remote_gateway for the dest vnet to peer. Controls if remote gateways can be used on the local virtual network. https://www.terraform.io/docs/providers/azurerm/r/virtual_network_peering.html#use_remote_gateways bool false no
use_remote_src_gateway Option use_remote_gateway for the src vnet to peer. Controls if remote gateways can be used on the local virtual network. https://www.terraform.io/docs/providers/azurerm/r/virtual_network_peering.html#use_remote_gateways bool false no
vnet_dest_id ID of the dest vnet to peer string n/a yes
vnet_src_id ID of the src vnet to peer string n/a yes

Outputs

Name Description
vnet_peering_dest_id Virtual network dest peering id
vnet_peering_dest_name Virtual network dest peering name
vnet_peering_src_id Virtual network src peering id
vnet_peering_src_name Virtual network src peering name

Related documentation

Terraform resource documentation: terraform.io/docs/providers/azurerm/r/virtual_network_peering.html

Microsoft Azure documentation: docs.microsoft.com/en-us/azure/virtual-network/virtual-network-peering-overview

terraform-azurerm-vnet-peering's People

Contributors

shr3ps avatar rossifumax avatar letorterwan avatar cp3hu avatar bzspi avatar bd-clara avatar pdecat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.