Skip to content

Commit cfd9c2f

Browse files
Copilotjtracey93
andcommitted
Add container_registry_zone_redundancy_enabled variable to decouple ACR zone redundancy from private networking
Fixes the issue where zone_redundancy_enabled for the container registry was tied to use_private_networking, causing failures in regions that don't support zone redundancy (e.g., Jio India West). Re-uses the existing agent_container_zone_support / runner_container_zone_support variables to control both container instance zones and container registry zone redundancy. Co-authored-by: jtracey93 <41163455+jtracey93@users.noreply.github.com>
1 parent 133800b commit cfd9c2f

6 files changed

Lines changed: 23 additions & 5 deletions

File tree

alz/azuredevops/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ module "azure" {
4949
virtual_network_subnet_address_prefix_container_instances = var.virtual_network_subnet_address_prefix_container_instances
5050
virtual_network_subnet_address_prefix_private_endpoints = var.virtual_network_subnet_address_prefix_private_endpoints
5151
storage_account_replication_type = var.storage_account_replication_type
52+
container_registry_zone_redundancy_enabled = var.agent_container_zone_support
5253
public_ip_name = local.resource_names.public_ip
5354
nat_gateway_name = local.resource_names.nat_gateway
5455
use_self_hosted_agents = var.use_self_hosted_agents

alz/azuredevops/variables.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,11 @@ variable "agent_container_memory_max" {
391391

392392
variable "agent_container_zone_support" {
393393
description = <<-EOT
394-
**(Optional, default: `true`)** Enable availability zone support for Azure DevOps agent container instances.
394+
**(Optional, default: `true`)** Enable availability zone support for Azure DevOps agent container instances and container registry.
395395
396-
When enabled, containers are distributed across availability zones for higher availability and resilience.
396+
When enabled, containers are distributed across availability zones for higher availability and resilience,
397+
and the container registry is configured with zone redundancy.
398+
Some regions do not support availability zones, in which case this should be set to false.
397399
EOT
398400
type = bool
399401
default = true

alz/github/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module "azure" {
5050
virtual_network_subnet_address_prefix_container_instances = var.virtual_network_subnet_address_prefix_container_instances
5151
virtual_network_subnet_address_prefix_private_endpoints = var.virtual_network_subnet_address_prefix_private_endpoints
5252
storage_account_replication_type = var.storage_account_replication_type
53+
container_registry_zone_redundancy_enabled = var.runner_container_zone_support
5354
public_ip_name = local.resource_names.public_ip
5455
nat_gateway_name = local.resource_names.nat_gateway
5556
use_self_hosted_agents = var.use_self_hosted_runners

alz/github/variables.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,11 @@ variable "runner_container_memory_max" {
496496

497497
variable "runner_container_zone_support" {
498498
description = <<-EOT
499-
**(Optional, default: `true`)** Enable availability zone support for GitHub runner container instances.
499+
**(Optional, default: `true`)** Enable availability zone support for GitHub runner container instances and container registry.
500500
501-
When enabled, containers are distributed across availability zones for higher availability and resilience.
501+
When enabled, containers are distributed across availability zones for higher availability and resilience,
502+
and the container registry is configured with zone redundancy.
503+
Some regions do not support availability zones, in which case this should be set to false.
502504
EOT
503505
type = bool
504506
default = true

modules/azure/container_registry.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ resource "azurerm_container_registry" "alz" {
55
location = var.azure_location
66
sku = var.use_private_networking ? "Premium" : "Basic"
77
public_network_access_enabled = !var.use_private_networking
8-
zone_redundancy_enabled = var.use_private_networking
8+
zone_redundancy_enabled = var.use_private_networking && var.container_registry_zone_redundancy_enabled
99
network_rule_bypass_option = var.use_private_networking ? "AzureServices" : "None"
1010
}
1111

modules/azure/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,18 @@ variable "container_registry_image_name" {
528528
default = ""
529529
}
530530

531+
variable "container_registry_zone_redundancy_enabled" {
532+
description = <<-EOT
533+
**(Optional, default: `true`)** Enable zone redundancy for the Azure Container Registry.
534+
535+
When enabled, the container registry is replicated across availability zones for higher availability.
536+
Some regions do not support zone redundancy, in which case this should be set to false.
537+
Zone redundancy requires Premium SKU, which is only used when private networking is enabled.
538+
EOT
539+
type = bool
540+
default = true
541+
}
542+
531543
variable "container_registry_image_tag" {
532544
description = <<-EOT
533545
**(Optional, default: `"{{.Run.ID}}"`)** Tag pattern for the container image.

0 commit comments

Comments
 (0)