diff --git a/modules/azure/container_registry.tf b/modules/azure/container_registry.tf index 2b2ce94e..295f7f61 100644 --- a/modules/azure/container_registry.tf +++ b/modules/azure/container_registry.tf @@ -1,23 +1,13 @@ resource "azurerm_container_registry" "alz" { - count = var.use_self_hosted_agents ? 1 : 0 - name = var.container_registry_name - resource_group_name = azurerm_resource_group.agents[0].name - location = var.azure_location - sku = var.use_private_networking ? "Premium" : "Basic" - public_network_access_enabled = !var.use_private_networking - zone_redundancy_enabled = var.use_private_networking && var.container_registry_zone_redundancy_enabled - network_rule_bypass_option = var.use_private_networking ? "AzureServices" : "None" -} - -resource "azapi_update_resource" "network_rule_bypass_allowed_for_tasks" { - count = var.use_self_hosted_agents && var.use_private_networking ? 1 : 0 - type = "Microsoft.ContainerRegistry/registries@2025-05-01-preview" - resource_id = azurerm_container_registry.alz[0].id - body = { - properties = { - networkRuleBypassAllowedForTasks = true - } - } + count = var.use_self_hosted_agents ? 1 : 0 + name = var.container_registry_name + resource_group_name = azurerm_resource_group.agents[0].name + location = var.azure_location + sku = var.use_private_networking ? "Premium" : "Basic" + public_network_access_enabled = !var.use_private_networking + zone_redundancy_enabled = var.use_private_networking && var.container_registry_zone_redundancy_enabled + network_rule_bypass_option = var.use_private_networking ? "AzureServices" : "None" + network_rule_bypass_for_tasks_enabled = var.use_private_networking } resource "azurerm_container_registry_task" "alz" { @@ -51,8 +41,7 @@ resource "azurerm_container_registry_task_schedule_run_now" "alz" { replace_triggered_by = [azurerm_container_registry_task.alz] } depends_on = [ - azurerm_role_assignment.container_registry_push_for_task, - azapi_update_resource.network_rule_bypass_allowed_for_tasks + azurerm_role_assignment.container_registry_push_for_task ] } diff --git a/modules/azure/terraform.tf b/modules/azure/terraform.tf index c30ea0f0..7fb11339 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.81" } azapi = { source = "azure/azapi"