From 804d4d38b0b2c3220675b6359445e8d54fa1aa98 Mon Sep 17 00:00:00 2001 From: kewalaka Date: Sat, 25 May 2024 13:19:47 +1200 Subject: [PATCH] fix: use the submodule as per changes in AVM upstream --- locals.tf | 1 - main.tf | 24 +++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/locals.tf b/locals.tf index 68f9473..5563ff4 100644 --- a/locals.tf +++ b/locals.tf @@ -13,6 +13,5 @@ locals { }, sv.route_table, {}) } ) - if !(sv == "network_security_group_key" || sv == "route_table_key") } } diff --git a/main.tf b/main.tf index 34b7da0..01bfb54 100644 --- a/main.tf +++ b/main.tf @@ -1,17 +1,27 @@ module "subnets" { - for_each = var.subnets + for_each = local.subnets # TODO revert to Azure org pending fix: https://github.com/Azure/terraform-azurerm-avm-res-network-virtualnetwork/pull/74 - source = "git::https://github.com/kewalaka/terraform-azurerm-avm-res-network-virtualnetwork?ref=dev" - # source = "Azure/avm-res-network-virtualnetwork/azurerm" + source = "git::https://github.com/kewalaka/terraform-azurerm-avm-res-network-virtualnetwork//modules/subnet?ref=feat/use-azapi-for-subnets" + # source = "Azure/avm-res-network-virtualnetwork/modules/subnet/azurerm" # version = "0.2.0" - existing_vnet = { + virtual_network = { resource_id = var.virtual_network_resource_id } - location = var.location - resource_group_name = var.resource_group_name - subnets = local.subnets + name = each.value.name + address_prefixes = each.value.address_prefixes + + default_outbound_access_enabled = try(each.value.default_outbound_access_enabled, false) + delegation = try(each.value.delegation, null) + nat_gateway = try(each.value.nat_gateway, null) + network_security_group = each.value.network_security_group + private_endpoint_network_policies = coalesce(each.value.private_endpoint_network_policies, "Enabled") + private_link_service_network_policies_enabled = coalesce(each.value.private_link_service_network_policies_enabled, true) + role_assignments = try(each.value.role_assignments, {}) + route_table = each.value.route_table + service_endpoint_policies = try(each.value.service_endpoint_policies, null) + service_endpoints = try(each.value.service_endpoints, null) depends_on = [module.network_security_groups] }