Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions modules/azure-vnet-peering/.terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
formatter: "markdown"

version: ""

header-from: docs/header.md
footer-from: docs/footer.md

recursive:
enabled: false
path: modules
include-main: true

sections:
hide: []
show: []

content: ""

output:
file: "README.md"
mode: inject
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->

output-values:
enabled: false
from: ""

sort:
enabled: true
by: name

settings:
anchor: true
color: true
default: true
description: false
escape: true
hide-empty: false
html: true
indent: 2
lockfile: true
read-comments: true
required: true
sensitive: true
type: true
113 changes: 76 additions & 37 deletions modules/azure-vnet-peering/README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,93 @@
# Azure virtual network peering module
<!-- BEGIN_TF_DOCS -->
# Azure Virtual Network Peering Module

## Overview
This Terraform module creates a virtual network peering between two Azure virtual networks.

This module creates a virtual network peering between two virtual networks.
## Features
- Creates peering from origin to destination VNet
- Creates peering from destination to origin VNet
- Supports custom names for each peering

## Requirements

- Resource group origin created.
- Resource group destination created.
- Virtual network origin created (VNet).
- Virtual network destination created (VNet).
## Real usage example

## DOC
```hcl
module "azure_vnet_peering" {
source = "git::https://github.com/prefapp/tfm.git//modules/azure-vnet-peering?ref=<version>"

- [Resource terraform - virtual network peering](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network_peering)
################
# VNET ORIGIN #
################

## Usage
origin_virtual_network_name = "origen-vnet"
origin_resource_group_name = "test-peering"
origin_name_peering = "origen-vnet-to-destino-vnet"

### Set a module
#####################
# VNET DESTINATION #
#####################

```terraform
module "azure-vnet-peering" {
source = "git::https://github.com/prefapp/tfm.git//modules/azure-vnet-peering?ref=<version>"
destination_virtual_network_name = "destino-vnet"
destination_resource_group_name = "test-peering"
destination_name_peering = "destino-vnet-to-origen-vnet"
}
```

#### Example
## Requirements

```terraform
module "azure-aks" {
source = "git::https://github.com/prefapp/tfm.git//modules/azure-vnet-peering?ref=v1.2.3"
}
```
| Name | Version |
|------|---------|
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | >=3.85.0 |

### Set a data .tfvars
## Providers

```hcl
###############
# VNET ORIGIN #
###############
| Name | Version |
|------|---------|
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | >=3.85.0 |

origin_virtual_network_name = "origen-vnet"
origin_resource_group_name = "test-peering"
origin_name_peering = "origen-vnet-to-destino-vnet"
## Modules

####################
# VNET DESTINATION #
####################
No modules.

destination_virtual_network_name = "destino-vnet"
destination_resource_group_name = "test-peering"
destination_name_peering = "destino-vnet-to-origen-vnet"
```
## Resources

| Name | Type |
|------|------|
| [azurerm_virtual_network_peering.destination-to-origin](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network_peering) | resource |
| [azurerm_virtual_network_peering.origin-to-destination](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network_peering) | resource |
| [azurerm_virtual_network.id_virtual_network_destination](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/virtual_network) | data source |
| [azurerm_virtual_network.id_virtual_network_origin](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/virtual_network) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_destination_name_peering"></a> [destination\_name\_peering](#input\_destination\_name\_peering) | (Required) The name of the destination to origin peering. Changing this forces a new resource to be created. | `string` | n/a | yes |
| <a name="input_destination_resource_group_name"></a> [destination\_resource\_group\_name](#input\_destination\_resource\_group\_name) | (Required) The name of the resource group in which to create the destination virtual network. Changing this forces a new resource to be created. | `string` | n/a | yes |
| <a name="input_destination_virtual_network_name"></a> [destination\_virtual\_network\_name](#input\_destination\_virtual\_network\_name) | (Required) The name of the destination virtual network. Changing this forces a new resource to be created. | `string` | n/a | yes |
| <a name="input_origin_name_peering"></a> [origin\_name\_peering](#input\_origin\_name\_peering) | (Required) The name of the origin to destination peering. Changing this forces a new resource to be created. | `string` | n/a | yes |
| <a name="input_origin_resource_group_name"></a> [origin\_resource\_group\_name](#input\_origin\_resource\_group\_name) | (Required) The name of the resource group in which to create the origin virtual network. Changing this forces a new resource to be created. | `string` | n/a | yes |
| <a name="input_origin_virtual_network_name"></a> [origin\_virtual\_network\_name](#input\_origin\_virtual\_network\_name) | (Required) The name of the origin virtual network. Changing this forces a new resource to be created. | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_destination_name_peering_output"></a> [destination\_name\_peering\_output](#output\_destination\_name\_peering\_output) | n/a |
| <a name="output_destination_resource_group_name_output"></a> [destination\_resource\_group\_name\_output](#output\_destination\_resource\_group\_name\_output) | n/a |
| <a name="output_destination_virtual_network_name_output"></a> [destination\_virtual\_network\_name\_output](#output\_destination\_virtual\_network\_name\_output) | n/a |
| <a name="output_origin_name_peering_output"></a> [origin\_name\_peering\_output](#output\_origin\_name\_peering\_output) | n/a |
| <a name="output_origin_resource_group_name_output"></a> [origin\_resource\_group\_name\_output](#output\_origin\_resource\_group\_name\_output) | n/a |
| <a name="output_origin_virtual_network_name_output"></a> [origin\_virtual\_network\_name\_output](#output\_origin\_virtual\_network\_name\_output) | n/a |

## Examples

For detailed examples, refer to the [module examples](https://github.com/prefapp/tfm/tree/main/modules/azure-vnet-peering/_examples):

- [basic](https://github.com/prefapp/tfm/tree/main/modules/azure-vnet-peering/_examples/basic) - Bidirectional peering between hub and spoke virtual networks.

## Resources
- [Terraform AzureRM Provider: virtual network peering](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network_peering)

## Support
For issues, questions, or contributions related to this module, please visit the [repository's issue tracker](https://github.com/prefapp/tfm/issues).
<!-- END_TF_DOCS -->
13 changes: 13 additions & 0 deletions modules/azure-vnet-peering/_examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Basic example: bidirectional VNet peering between two VNets

module "azure_vnet_peering" {
source = "../../"

origin_virtual_network_name = "hub-vnet"
origin_resource_group_name = "network-rg"
origin_name_peering = "hub-to-spoke"

destination_virtual_network_name = "spoke-vnet"
destination_resource_group_name = "network-rg"
destination_name_peering = "spoke-to-hub"
}
9 changes: 9 additions & 0 deletions modules/azure-vnet-peering/_examples/basic/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Basic example values for azure-vnet-peering module

origin_virtual_network_name: hub-vnet
origin_resource_group_name: network-rg
origin_name_peering: hub-to-spoke

destination_virtual_network_name: spoke-vnet
destination_resource_group_name: network-rg
destination_name_peering: spoke-to-hub
11 changes: 11 additions & 0 deletions modules/azure-vnet-peering/docs/footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Examples

For detailed examples, refer to the [module examples](https://github.com/prefapp/tfm/tree/main/modules/azure-vnet-peering/_examples):

- [basic](https://github.com/prefapp/tfm/tree/main/modules/azure-vnet-peering/_examples/basic) - Bidirectional peering between hub and spoke virtual networks.

## Resources
- [Terraform AzureRM Provider: virtual network peering](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network_peering)

## Support
For issues, questions, or contributions related to this module, please visit the [repository's issue tracker](https://github.com/prefapp/tfm/issues).
32 changes: 32 additions & 0 deletions modules/azure-vnet-peering/docs/header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Azure Virtual Network Peering Module

This Terraform module creates a virtual network peering between two Azure virtual networks.

## Features
- Creates peering from origin to destination VNet
- Creates peering from destination to origin VNet
- Supports custom names for each peering

## Real usage example

```hcl
module "azure_vnet_peering" {
source = "git::https://github.com/prefapp/tfm.git//modules/azure-vnet-peering?ref=<version>"

################
# VNET ORIGIN #
################

origin_virtual_network_name = "origen-vnet"
origin_resource_group_name = "test-peering"
origin_name_peering = "origen-vnet-to-destino-vnet"

#####################
# VNET DESTINATION #
#####################

destination_virtual_network_name = "destino-vnet"
destination_resource_group_name = "test-peering"
destination_name_peering = "destino-vnet-to-origen-vnet"
}
```