From 86449f936c4342e310de3c2b26c564c9a2554e06 Mon Sep 17 00:00:00 2001 From: Vedant Date: Fri, 10 Jan 2025 03:32:35 +0530 Subject: [PATCH] Fix : Updated Github Workflows and added Latest Azurerm Version --- main.tf | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/main.tf b/main.tf index b5d24df..3533091 100644 --- a/main.tf +++ b/main.tf @@ -70,7 +70,7 @@ resource "azurerm_firewall" "firewall" { threat_intel_mode = var.threat_intel_mode sku_tier = var.sku_tier sku_name = var.sku_name - firewall_policy_id = join("", azurerm_firewall_policy.policy.*.id) + firewall_policy_id = azurerm_firewall_policy.policy[count.index].id tags = module.labels.tags private_ip_ranges = var.firewall_private_ip_ranges dns_servers = var.dns_servers @@ -82,7 +82,7 @@ resource "azurerm_firewall" "firewall" { # var.enable_ip_subnet will be true when individual public ip and prefix public ip both are to be deployed (none of them exist before) or only individual public ip are to be deployed. # var.enable_ip_subnet will be false when prefix_public_ip already exists and there are no individual public ip. subnet_id = var.enable_ip_subnet ? it.key == 0 ? var.subnet_id : null : null - public_ip_address_id = azurerm_public_ip.public_ip.*.id[it.key] + public_ip_address_id = azurerm_public_ip.public_ip[it.key].id } } @@ -94,7 +94,7 @@ resource "azurerm_firewall" "firewall" { # var.enable_prefix_subnet will only be true when prefix public ips are to be deployed during initial apply and there are no individual public ips to be created. # Individual public ips can be deployed after initial apply and var.enable_ip_subnet variable must be false. subnet_id = var.enable_prefix_subnet ? it.key == 0 ? var.subnet_id : null : null - public_ip_address_id = azurerm_public_ip.prefix_public_ip.*.id[it.key] + public_ip_address_id = azurerm_public_ip.prefix_public_ip[it.key].id } } @@ -129,7 +129,9 @@ resource "azurerm_firewall_policy" "policy" { for_each = var.identity_type != null && var.sku_policy == "Premium" && var.sku_tier == "Premium" ? [1] : [] content { type = var.identity_type - identity_ids = var.identity_type == "UserAssigned" ? [join("", azurerm_user_assigned_identity.identity.*.id)] : null + identity_ids = var.identity_type == "UserAssigned" ? [join(",", azurerm_user_assigned_identity.identity[*].id)] : null + + } } } @@ -152,8 +154,9 @@ resource "azurerm_user_assigned_identity" "identity" { resource "azurerm_firewall_policy_rule_collection_group" "app_policy_rule_collection_group" { count = var.enabled && var.policy_rule_enabled ? 1 : 0 name = var.app_policy_collection_group - firewall_policy_id = var.firewall_policy_id == null ? join("", azurerm_firewall_policy.policy.*.id) : var.firewall_policy_id - priority = 300 + firewall_policy_id = var.firewall_policy_id == null ? (length(azurerm_firewall_policy.policy) > 0 ? join(",", azurerm_firewall_policy.policy[*].id) : null) : var.firewall_policy_id + + priority = 300 dynamic "application_rule_collection" { for_each = var.application_rule_collection @@ -190,7 +193,7 @@ resource "azurerm_firewall_policy_rule_collection_group" "app_policy_rule_collec resource "azurerm_firewall_policy_rule_collection_group" "network_policy_rule_collection_group" { count = var.enabled && var.policy_rule_enabled ? 1 : 0 name = var.net_policy_collection_group - firewall_policy_id = var.firewall_policy_id == null ? join("", azurerm_firewall_policy.policy.*.id) : var.firewall_policy_id + firewall_policy_id = var.firewall_policy_id == null ? (length(azurerm_firewall_policy.policy) > 0 ? join(",", azurerm_firewall_policy.policy[*].id) : null) : var.firewall_policy_id priority = 200