diff --git a/alz/azuredevops/main.tf b/alz/azuredevops/main.tf index 33c0227a..be00490b 100644 --- a/alz/azuredevops/main.tf +++ b/alz/azuredevops/main.tf @@ -52,6 +52,7 @@ module "azure" { container_registry_zone_redundancy_enabled = coalesce(var.container_registry_zone_redundancy_enabled, var.agent_container_zone_support) public_ip_name = local.resource_names.public_ip nat_gateway_name = local.resource_names.nat_gateway + nat_gateway_zone_redundancy_enabled = var.nat_gateway_zone_redundancy_enabled use_self_hosted_agents = var.use_self_hosted_agents container_registry_name = local.resource_names.container_registry container_registry_private_endpoint_name = local.resource_names.container_registry_private_endpoint diff --git a/alz/azuredevops/terraform.tf b/alz/azuredevops/terraform.tf index ba0dc2fe..e11845ea 100644 --- a/alz/azuredevops/terraform.tf +++ b/alz/azuredevops/terraform.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~> 4.20" + version = "~> 4.67" } azapi = { source = "azure/azapi" diff --git a/alz/azuredevops/variables.tf b/alz/azuredevops/variables.tf index b3801635..f43b1c31 100644 --- a/alz/azuredevops/variables.tf +++ b/alz/azuredevops/variables.tf @@ -440,6 +440,21 @@ variable "container_registry_zone_redundancy_enabled" { default = null } +variable "nat_gateway_zone_redundancy_enabled" { + description = <<-EOT + **(Optional, default: `false`)** Deploy a zone-redundant NAT Gateway and Public IP. + + When enabled, the NAT Gateway and its Public IP use the `StandardV2` SKU, and the Public IP spans the availability zones of the region. + When disabled, both use the `Standard` SKU with no availability zones. + Changing this value replaces the NAT Gateway and Public IP, which changes the outbound IP address of the agents. + Some regions do not support the `StandardV2` NAT Gateway, in which case this should be set to false. + Only used when `use_private_networking` and `use_self_hosted_agents` are enabled. + EOT + type = bool + default = false + nullable = false +} + variable "built_in_configuration_file_names" { description = <<-EOT **(Optional, default: `["config.yaml", "config-hub-and-spoke-vnet.yaml", "config-virtual-wan.yaml"]`)** diff --git a/alz/github/main.tf b/alz/github/main.tf index 19005b0a..abbe2512 100644 --- a/alz/github/main.tf +++ b/alz/github/main.tf @@ -53,6 +53,7 @@ module "azure" { container_registry_zone_redundancy_enabled = coalesce(var.container_registry_zone_redundancy_enabled, var.runner_container_zone_support) public_ip_name = local.resource_names.public_ip nat_gateway_name = local.resource_names.nat_gateway + nat_gateway_zone_redundancy_enabled = var.nat_gateway_zone_redundancy_enabled use_self_hosted_agents = var.use_self_hosted_runners container_registry_name = local.resource_names.container_registry container_registry_private_endpoint_name = local.resource_names.container_registry_private_endpoint diff --git a/alz/github/terraform.tf b/alz/github/terraform.tf index 9b2c38ab..8e8e370b 100644 --- a/alz/github/terraform.tf +++ b/alz/github/terraform.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~> 4.20" + version = "~> 4.67" } azapi = { source = "azure/azapi" diff --git a/alz/github/variables.tf b/alz/github/variables.tf index 24696c4c..6d8ca1a9 100644 --- a/alz/github/variables.tf +++ b/alz/github/variables.tf @@ -545,6 +545,21 @@ variable "container_registry_zone_redundancy_enabled" { default = null } +variable "nat_gateway_zone_redundancy_enabled" { + description = <<-EOT + **(Optional, default: `false`)** Deploy a zone-redundant NAT Gateway and Public IP. + + When enabled, the NAT Gateway and its Public IP use the `StandardV2` SKU, and the Public IP spans the availability zones of the region. + When disabled, both use the `Standard` SKU with no availability zones. + Changing this value replaces the NAT Gateway and Public IP, which changes the outbound IP address of the runners. + Some regions do not support the `StandardV2` NAT Gateway, in which case this should be set to false. + Only used when `use_private_networking` and `use_self_hosted_runners` are enabled. + EOT + type = bool + default = false + nullable = false +} + variable "runner_name_environment_variable" { description = <<-EOT **(Optional, default: `"GH_RUNNER_NAME"`)** The runner name environment variable supplied to the container. diff --git a/alz/local/terraform.tf b/alz/local/terraform.tf index 00a4f29b..3459e20c 100644 --- a/alz/local/terraform.tf +++ b/alz/local/terraform.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~> 4.20" + version = "~> 4.67" } azapi = { source = "azure/azapi" diff --git a/modules/azure/networking.tf b/modules/azure/networking.tf index d2b5d105..c250babd 100644 --- a/modules/azure/networking.tf +++ b/modules/azure/networking.tf @@ -12,7 +12,8 @@ resource "azurerm_public_ip" "alz" { location = var.azure_location resource_group_name = azurerm_resource_group.network[0].name allocation_method = "Static" - sku = "Standard" + sku = var.nat_gateway_zone_redundancy_enabled ? "StandardV2" : "Standard" + zones = var.nat_gateway_zone_redundancy_enabled && length(local.bootstrap_location_zones) > 0 ? local.bootstrap_location_zones : null } resource "azurerm_nat_gateway" "alz" { @@ -20,7 +21,7 @@ resource "azurerm_nat_gateway" "alz" { name = var.nat_gateway_name location = var.azure_location resource_group_name = azurerm_resource_group.network[0].name - sku_name = "Standard" + sku_name = var.nat_gateway_zone_redundancy_enabled ? "StandardV2" : "Standard" } resource "azurerm_nat_gateway_public_ip_association" "alz" { diff --git a/modules/azure/terraform.tf b/modules/azure/terraform.tf index c30ea0f0..4fdddbea 100644 --- a/modules/azure/terraform.tf +++ b/modules/azure/terraform.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~> 4.20" + version = "~> 4.67" } azapi = { source = "azure/azapi" diff --git a/modules/azure/variables.tf b/modules/azure/variables.tf index dfbfc779..63e5767a 100644 --- a/modules/azure/variables.tf +++ b/modules/azure/variables.tf @@ -395,6 +395,20 @@ variable "nat_gateway_name" { default = "" } +variable "nat_gateway_zone_redundancy_enabled" { + description = <<-EOT + **(Optional, default: `false`)** Deploy a zone-redundant NAT Gateway and Public IP. + + When enabled, the NAT Gateway and its Public IP use the `StandardV2` SKU, and the Public IP spans the availability zones of the region. + When disabled, both use the `Standard` SKU with no availability zones. + Changing this value replaces the NAT Gateway and Public IP, which changes the outbound IP address of the agents. + Some regions do not support the `StandardV2` NAT Gateway, in which case this should be set to false. + EOT + type = bool + default = false + nullable = false +} + variable "virtual_network_subnet_name_container_instances" { description = <<-EOT **(Optional, default: `""`)** Name of the subnet delegated for Azure Container Instances.