Update gateway_policy.tf
Some checks failed
Terraform Apply / Terraform Apply (push) Failing after 12s

This commit is contained in:
2025-11-17 14:47:23 +01:00
parent bc47309b48
commit 88094ac436

View File

@@ -36,6 +36,25 @@ locals {
pihole_ad_filter = join(" or ", local.pihole_ad_filters) pihole_ad_filter = join(" or ", local.pihole_ad_filters)
} }
resource "cloudflare_teams_rule" "block_ads" {
account_id = local.cloudflare_account_id
name = "Block Ads"
description = "Block Ads domains"
enabled = true
precedence = 11
# Block domain belonging to lists (defined below)
filters = ["dns"]
action = "block"
traffic = local.pihole_ad_filter
rule_settings {
block_page_enabled = false
}
}
locals { locals {
# The full path of the list holding the domain list # The full path of the list holding the domain list
pihole_domain_list_file = "${path.module}/lists/pihole_domain_list.txt" pihole_domain_list_file = "${path.module}/lists/pihole_domain_list.txt"
@@ -54,23 +73,17 @@ locals {
pihole_list_count = length(local.pihole_aggregated_lists) pihole_list_count = length(local.pihole_aggregated_lists)
} }
resource "cloudflare_teams_rule" "block_ads" { resource "cloudflare_teams_list" "pihole_domain_lists" {
account_id = local.cloudflare_account_id account_id = local.cloudflare_account_id
name = "Block Ads" for_each = {
description = "Block Ads domains" for i in range(0, local.pihole_list_count) :
i => element(local.pihole_aggregated_lists, i)
enabled = true
precedence = 11
# Block domain belonging to lists (defined below)
filters = ["dns"]
action = "block"
traffic = local.pihole_ad_filter
rule_settings {
block_page_enabled = false
} }
name = "pihole_domain_list_${each.key}"
type = "DOMAIN"
items = each.value
} }
# #