Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issues with threat_intelligence_allowlist variable type and dynamic block #887

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/connectivity/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ variable "settings" {
base_policy_id = optional(string, "")
private_ip_ranges = optional(list(string), [])
threat_intelligence_mode = optional(string, "Alert")
threat_intelligence_allowlist = optional(list(string), [])
threat_intelligence_allowlist = optional(map(list(string)), {})
availability_zones = optional(object({
zone_1 = optional(bool, true)
zone_2 = optional(bool, true)
Expand Down Expand Up @@ -200,7 +200,7 @@ variable "settings" {
base_policy_id = optional(string, "")
private_ip_ranges = optional(list(string), [])
threat_intelligence_mode = optional(string, "Alert")
threat_intelligence_allowlist = optional(list(string), [])
threat_intelligence_allowlist = optional(map(list(string)), {})
availability_zones = optional(object({
zone_1 = optional(bool, true)
zone_2 = optional(bool, true)
Expand Down
5 changes: 4 additions & 1 deletion resources.virtual_wan.tf
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,17 @@ resource "azurerm_firewall_policy" "virtual_wan" {
}

dynamic "threat_intelligence_allowlist" {
for_each = each.value.template.threat_intelligence_allowlist
# Ensure that the dynamic block is created only if the allowlist is defined
for_each = length(keys(each.value.template.threat_intelligence_allowlist)) > 0 ? [each.value.template.threat_intelligence_allowlist] : []

content {
# Optional attributes
fqdns = lookup(threat_intelligence_allowlist.value, "fqdns", null)
ip_addresses = lookup(threat_intelligence_allowlist.value, "ip_addresses", null)
}
}


# Set explicit dependencies
depends_on = [
azurerm_resource_group.connectivity,
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ variable "configure_connectivity_resources" {
base_policy_id = optional(string, "")
private_ip_ranges = optional(list(string), [])
threat_intelligence_mode = optional(string, "Alert")
threat_intelligence_allowlist = optional(list(string), [])
threat_intelligence_allowlist = optional(map(list(string)), {})
availability_zones = optional(object({
zone_1 = optional(bool, true)
zone_2 = optional(bool, true)
Expand Down Expand Up @@ -313,7 +313,7 @@ variable "configure_connectivity_resources" {
base_policy_id = optional(string, "")
private_ip_ranges = optional(list(string), [])
threat_intelligence_mode = optional(string, "Alert")
threat_intelligence_allowlist = optional(list(string), [])
threat_intelligence_allowlist = optional(map(list(string)), {})
availability_zones = optional(object({
zone_1 = optional(bool, true)
zone_2 = optional(bool, true)
Expand Down
Loading