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

This commit is contained in:
2025-11-17 15:11:05 +01:00
parent fe801bd24e
commit 0a3942133f

View File

@@ -5,10 +5,8 @@
# POLICY: block_malware
resource "cloudflare_zero_trust_gateway_policy" "block_malware" {
account_id = local.cloudflare_account_id
name = "Block malware"
description = "Block known threats based on Cloudflare s threat intelligence"
enabled = true
precedence = 10
@@ -38,17 +36,15 @@ locals {
resource "cloudflare_zero_trust_gateway_policy" "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.ads_ad_filter
action = "block"
rule_settings = {
block_page_enabled = false
@@ -57,11 +53,12 @@ resource "cloudflare_zero_trust_gateway_policy" "block_ads" {
locals {
# The full path of the list holding the domain list
ads_domain_list_file = fileset("${path.module}/lists/pihole_domain_list.txt", "*.txt")
# ads_domain_list_file = file("${path.module}/lists/pihole_domain_list.txt")
ads_domain_list_file = "${path.module}/lists/pihole_domain_list.txt"
# Parse the file and create a list, one item per line
#ads_domain_list = split("\n", file(local.ads_domain_list_file))
ads_domain_list = length(local.ads_domain_list_file) > 0 ? split("\n", file(local.ads_domain_list_file)) : []
ads_domain_list = length(file(local.ads_domain_list_file)) > 0 ? split("\n", file(local.ads_domain_list_file)) : []
# Remove empty lines
ads_domain_list_clean = [for x in local.ads_domain_list : x if x != ""]