diff --git a/modules/azure/networking/README.md b/modules/azure/networking/README.md index 6f511e9..5cbd306 100644 --- a/modules/azure/networking/README.md +++ b/modules/azure/networking/README.md @@ -89,7 +89,8 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [environment](#input\_environment) | Environment like: infra-ops, dev, stage, prod | `string` | n/a | yes | +| [availability\_zones](#input\_availability\_zones) | Availability zones for nat gateway and public ips | `list(string)` | n/a | yes | +| [nat\_prefix](#input\_nat\_prefix) | Prefix of the nat gateway & public ip address | `string` | `""` | no | | [resource\_group\_name](#input\_resource\_group\_name) | Azure resource group name | `string` | n/a | yes | | [subnets](#input\_subnets) | Azure subnets and their configuration |
map(object({| n/a | yes | | [vnet\_address\_space](#input\_vnet\_address\_space) | Address space for the virtual network | `list(string)` | n/a | yes | diff --git a/modules/azure/networking/main.tf b/modules/azure/networking/main.tf index a0e882c..2786115 100644 --- a/modules/azure/networking/main.tf +++ b/modules/azure/networking/main.tf @@ -27,21 +27,21 @@ resource "azurerm_subnet" "subnets" { resource "azurerm_public_ip" "nat_address" { count = 2 - name = "nat-external-address-${count.index}" + name = "${var.nat_prefix}-nat-external-address-${count.index}" location = var.vnet_location resource_group_name = var.resource_group_name allocation_method = "Static" sku = "Standard" - zones = ["1"] + zones = var.availability_zones } resource "azurerm_nat_gateway" "nat_gateway" { - name = "${var.environment}-nat-gateway" + name = "${var.nat_prefix}-nat-gateway" location = var.vnet_location resource_group_name = var.resource_group_name sku_name = "Standard" idle_timeout_in_minutes = 10 - zones = ["1"] + zones = var.availability_zones } resource "azurerm_nat_gateway_public_ip_association" "nat_address_gateway_association" { diff --git a/modules/azure/networking/variables.tf b/modules/azure/networking/variables.tf index 00f4bd0..0dd5e01 100644 --- a/modules/azure/networking/variables.tf +++ b/modules/azure/networking/variables.tf @@ -1,8 +1,3 @@ -variable "environment" { - description = "Environment like: infra-ops, dev, stage, prod" - type = string -} - variable "resource_group_name" { description = "Azure resource group name" type = string @@ -18,11 +13,22 @@ variable "vnet_location" { type = string } +variable "availability_zones" { + description = "Availability zones for nat gateway and public ips" + type = list(string) +} + variable "vnet_address_space" { description = "Address space for the virtual network" type = list(string) } +variable "nat_prefix" { + description = "Prefix of the nat gateway & public ip address" + type = string + default = "" + +} variable "subnets" { description = "Azure subnets and their configuration" type = map(object({
address_prefixes = list(string)
enable_nat = bool
service_endpoints = list(string)
private_endpoint_network_policies = string # Allowed values: "Disabled", "Enabled", "NetworkSecurityGroupEnabled" and "RouteTableEnabled"
delegations = map(object({
service_delegation_name = string
service_delegation_actions = list(string)
}))
security_rules = optional(map(object({
priority = number
direction = string
access = string
protocol = string
source_port_range = optional(string)
source_port_ranges = optional(list(string))
destination_port_range = optional(string)
destination_port_ranges = optional(list(string))
source_address_prefix = optional(string)
source_address_prefixes = optional(list(string))
destination_address_prefix = optional(string)
destination_address_prefixes = optional(list(string))
source_application_security_group_ids = optional(list(string))
})), {})
routes = optional(map(object({
address_prefix = string
next_hop_type = string
next_hop_in_ip_address = optional(string)
})))
}))