-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/azure localnet gateway #973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 60 commits
5718f01
7466c43
2b73169
968bcc8
c0cd825
20c8711
b2a80be
e67bf75
050685f
d7fca05
c82cdf2
6a47021
1595cc2
273accd
be03223
0a32bf3
fa6259d
481f071
01193c2
04b440e
75dccd9
518a235
d92d5ce
9c682c6
790bb0e
d373ea1
66ed4fb
b2c26e3
ada1977
bd0abd0
2ce3589
7c9ff60
f9c5784
176c93c
3937206
0dc8a66
5046fca
94ffaa6
ed9f159
11830d9
f14b46f
2dd7750
aa354ea
9e8031d
0e84d1a
f744cf0
a9115f8
3263ab6
f316eac
063cdff
d909650
1f3d7d5
b667721
06b4696
dbe5558
9a87f16
29341e6
f6a652f
7ce2e42
a78e4e0
2a518cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| <!-- BEGIN_TF_DOCS --> | ||
| # **Azure Local Network Gateway Terraform Module** | ||
|
|
||
| ## Overview | ||
|
|
||
| This module provisions and manages Azure Local Network Gateways for Site-to-Site VPN connections using the [azurerm\_local\_network\_gateway](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/local_network_gateway) resource. It is suitable for production, staging, and development environments, y puede integrarse en proyectos Terraform más grandes o usarse de forma independiente. | ||
|
|
||
| ## Key Features | ||
|
|
||
| - **Multiple Gateway Support**: Create one or more Azure Local Network Gateways with flexible configuration. | ||
| - **Custom Address Spaces**: Define custom address spaces and gateway IPs for each local network. | ||
| - **Tag Inheritance and Customization**: Inherit tags from the resource group or specify custom tags for all resources. | ||
| - **Extensible and Modular**: Designed for easy extension and integration with other Azure network modules. | ||
|
|
||
| ## Basic Usage | ||
|
|
||
| See the main README and the `_examples/` directory for usage examples. | ||
|
|
||
| ```hcl | ||
| module "localnet_gateway" { | ||
| source = "./modules/azure-localnet-gateway" | ||
| localnet = [ | ||
| { | ||
| local_gateway_name = "example-gateway" | ||
| location = "westeurope" | ||
| resource_group_name = "example-rg" | ||
| local_gateway_ip = "203.0.113.1" | ||
| local_gateway_address_space = ["10.1.0.0/16"] | ||
| tags_from_rg = true | ||
| tags = { | ||
| environment = "dev" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ## Requirements | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.7.0 | | ||
| | <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | 4.58.0 | | ||
|
|
||
| ## Providers | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 4.58.0 | | ||
|
|
||
| ## Modules | ||
|
|
||
| No modules. | ||
|
|
||
| ## Resources | ||
|
|
||
| | Name | Type | | ||
| |------|------| | ||
| | [azurerm_local_network_gateway.this](https://registry.terraform.io/providers/hashicorp/azurerm/4.58.0/docs/resources/local_network_gateway) | resource | | ||
| | [azurerm_resource_group.this](https://registry.terraform.io/providers/hashicorp/azurerm/4.58.0/docs/data-sources/resource_group) | data source | | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |------|-------------|------|---------|:--------:| | ||
| | <a name="input_localnet"></a> [localnet](#input\_localnet) | List of local network gateway objects | <pre>list(object({<br/> local_gateway_name = string<br/> location = string<br/> resource_group_name = string<br/> local_gateway_ip = string<br/> local_gateway_address_space = list(string)<br/> tags_from_rg = optional(bool)<br/> tags = optional(map(string))<br/> }))</pre> | `[]` | no | | ||
|
|
||
| ## Outputs | ||
|
|
||
| No outputs. | ||
|
Comment on lines
+68
to
+70
|
||
|
|
||
| ## Examples | ||
|
|
||
| For detailed examples, refer to the [module examples](https://github.com/prefapp/tfm/tree/main/modules/azure-localnet-gateway/_examples): | ||
|
|
||
| - [basic\_localnet](https://github.com/prefapp/tfm/tree/main/modules/azure-localnet-gateway/_examples/basic\_localnet) - Basic local network gateway example. | ||
| - [multiple\_address\_spaces](https://github.com/prefapp/tfm/tree/main/modules/azure-localnet-gateway/_examples/multiple\_address\_spaces) - Example with multiple address spaces. | ||
| - [with\_tags\_from\_rg](https://github.com/prefapp/tfm/tree/main/modules/azure-localnet-gateway/_examples/with\_tags\_from\_rg) - Example inheriting tags from the resource group. | ||
|
|
||
| ## Remote resources | ||
|
|
||
| - **Azure Local Network Gateway**: [azurerm\_local\_network\_gateway documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/local_network_gateway) | ||
| - **Terraform Azure Provider**: [Terraform Provider documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs) | ||
|
|
||
| ## 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 --> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| module "localnet_gateway" { | ||
| source = "../../" | ||
| localnet = [{ | ||
| local_gateway_name = "example-local-gw" | ||
| location = "westeurope" | ||
| resource_group_name = "example-rg" | ||
| local_gateway_ip = "203.0.113.1" | ||
| local_gateway_address_space = ["10.1.0.0/16"] | ||
| tags_from_rg = false | ||
| tags = { environment = "dev" } | ||
| }] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| localnet: | ||
| - local_gateway_name: example-local-gw | ||
| location: westeurope | ||
| resource_group_name: example-rg | ||
| local_gateway_ip: 203.0.113.1 | ||
| local_gateway_address_space: | ||
| - 10.1.0.0/16 | ||
| tags_from_rg: false | ||
| tags: | ||
| environment: dev |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| module "localnet_gateway" { | ||
| source = "../../" | ||
| localnet = [{ | ||
| local_gateway_name = "multi-space-gw" | ||
| location = "westeurope" | ||
| resource_group_name = "example-rg" | ||
| local_gateway_ip = "203.0.113.2" | ||
| local_gateway_address_space = ["10.1.0.0/16", "10.2.0.0/16"] | ||
| tags_from_rg = false | ||
| tags = { environment = "test" } | ||
| }] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| localnet: | ||
| - local_gateway_name: multi-space-gw | ||
| location: westeurope | ||
| resource_group_name: example-rg | ||
| local_gateway_ip: 203.0.113.2 | ||
| local_gateway_address_space: | ||
| - 10.1.0.0/16 | ||
| - 10.2.0.0/16 | ||
| tags_from_rg: false | ||
| tags: | ||
| environment: test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| module "localnet_gateway" { | ||
| source = "../../" | ||
| localnet = [{ | ||
| local_gateway_name = "tagged-gw" | ||
| location = "westeurope" | ||
| resource_group_name = "example-rg" | ||
| local_gateway_ip = "203.0.113.3" | ||
| local_gateway_address_space = ["10.3.0.0/16"] | ||
| tags_from_rg = true | ||
| tags = { custom = "yes" } | ||
| }] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| localnet: | ||
| - local_gateway_name: tagged-gw | ||
| location: westeurope | ||
| resource_group_name: example-rg | ||
| local_gateway_ip: 203.0.113.3 | ||
| local_gateway_address_space: | ||
| - 10.3.0.0/16 | ||
| tags_from_rg: true | ||
| tags: | ||
| custom: "yes" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ## DATA SOURCES SECTION | ||
|
|
||
| # https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/virtual_network | ||
| data "azurerm_resource_group" "this" { | ||
| for_each = { for idx, s in var.localnet : idx => s } | ||
jcframil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| name = each.value.resource_group_name | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ## Examples | ||
|
|
||
| For detailed examples, refer to the [module examples](https://github.com/prefapp/tfm/tree/main/modules/azure-localnet-gateway/_examples): | ||
|
|
||
| - [basic_localnet](https://github.com/prefapp/tfm/tree/main/modules/azure-localnet-gateway/_examples/basic_localnet) - Basic local network gateway example. | ||
| - [multiple_address_spaces](https://github.com/prefapp/tfm/tree/main/modules/azure-localnet-gateway/_examples/multiple_address_spaces) - Example with multiple address spaces. | ||
| - [with_tags_from_rg](https://github.com/prefapp/tfm/tree/main/modules/azure-localnet-gateway/_examples/with_tags_from_rg) - Example inheriting tags from the resource group. | ||
|
|
||
| ## Remote resources | ||
|
|
||
| - **Azure Local Network Gateway**: [azurerm_local_network_gateway documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/local_network_gateway) | ||
| - **Terraform Azure Provider**: [Terraform Provider documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs) | ||
|
|
||
| ## Support | ||
|
|
||
| For issues, questions, or contributions related to this module, please visit the [repository's issue tracker](https://github.com/prefapp/tfm/issues). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # **Azure Local Network Gateway Terraform Module** | ||
|
|
||
| ## Overview | ||
|
|
||
| This module provisions and manages Azure Local Network Gateways for Site-to-Site VPN connections using the [azurerm_local_network_gateway](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/local_network_gateway) resource. It is suitable for production, staging, and development environments, y puede integrarse en proyectos Terraform más grandes o usarse de forma independiente. | ||
|
|
||
jcframil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ## Key Features | ||
|
|
||
| - **Multiple Gateway Support**: Create one or more Azure Local Network Gateways with flexible configuration. | ||
| - **Custom Address Spaces**: Define custom address spaces and gateway IPs for each local network. | ||
| - **Tag Inheritance and Customization**: Inherit tags from the resource group or specify custom tags for all resources. | ||
| - **Extensible and Modular**: Designed for easy extension and integration with other Azure network modules. | ||
|
|
||
| ## Basic Usage | ||
|
|
||
| See the main README and the `_examples/` directory for usage examples. | ||
|
|
||
| ```hcl | ||
| module "localnet_gateway" { | ||
| source = "./modules/azure-localnet-gateway" | ||
| localnet = [ | ||
| { | ||
| local_gateway_name = "example-gateway" | ||
| location = "westeurope" | ||
| resource_group_name = "example-rg" | ||
| local_gateway_ip = "203.0.113.1" | ||
| local_gateway_address_space = ["10.1.0.0/16"] | ||
| tags_from_rg = true | ||
| tags = { | ||
| environment = "dev" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ## LOCALS SECTION | ||
|
|
||
| locals { | ||
| # Handle tags based on whether to use resource group tags or module-defined tags for each local network gateway (key = idx) | ||
| tags = { for idx, s in var.localnet : | ||
| idx => ( | ||
| coalesce(s.tags_from_rg, false) | ||
| ? merge(lookup(data.azurerm_resource_group.this, idx, null) != null ? data.azurerm_resource_group.this[idx].tags : {}, try(s.tags, {})) | ||
| : try(s.tags, {}) | ||
| ) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ## LOCAL NETWORK GATEWAY SECTION | ||
|
|
||
| # https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/local_network_gateway | ||
| resource "azurerm_local_network_gateway" "this" { | ||
| for_each = { for idx, s in var.localnet : idx => s } | ||
| name = each.value.local_gateway_name | ||
| location = each.value.location | ||
|
Comment on lines
+4
to
+7
|
||
| resource_group_name = each.value.resource_group_name | ||
| gateway_address = each.value.local_gateway_ip | ||
| address_space = each.value.local_gateway_address_space | ||
| tags = local.tags[each.key] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| ## VARIABLES SECTION | ||
|
|
||
| variable "localnet" { | ||
| description = "List of local network gateway objects" | ||
| type = list(object({ | ||
| local_gateway_name = string | ||
| location = string | ||
| resource_group_name = string | ||
| local_gateway_ip = string | ||
| local_gateway_address_space = list(string) | ||
| tags_from_rg = optional(bool) | ||
| tags = optional(map(string)) | ||
| })) | ||
| default = [] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| terraform { | ||
| required_version = ">= 1.7.0" | ||
|
|
||
| required_providers { | ||
| azurerm = { | ||
| source = "hashicorp/azurerm" | ||
| version = "4.58.0" | ||
| } | ||
|
Comment on lines
+4
to
+8
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,6 +150,15 @@ | |
| }, | ||
| "modules/aws-secretsmanager-replication": { | ||
| "package-name": "aws-secretsmanager-replication" | ||
| }, | ||
| "modules/azure-vnet-gateway": { | ||
| "package-name": "azure-vnet-gateway" | ||
| }, | ||
| "modules/azure-vnet-gateway-connection": { | ||
| "package-name": "azure-vnet-gateway-connection" | ||
| }, | ||
|
Comment on lines
+154
to
+159
|
||
| "modules/azure-localnet-gateway": { | ||
| "package-name": "azure-localnet-gateway" | ||
| } | ||
|
Comment on lines
+160
to
162
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The overview paragraph mixes English and Spanish (“y puede integrarse…”). If the module docs are intended to be English (as in the rest of the repo), translate this fragment to keep documentation consistent.