diff --git a/gateway_policy.tf b/gateway_policy.tf index 60f4215..0546045 100644 --- a/gateway_policy.tf +++ b/gateway_policy.tf @@ -4,18 +4,16 @@ # POLICY: block_malware resource "cloudflare_zero_trust_gateway_policy" "block_malware" { - account_id = local.cloudflare_account_id - + account_id = local.cloudflare_account_id name = "Block malware" description = "Block known threats based on Cloudflare s threat intelligence" - - enabled = true - precedence = 10 + enabled = true + precedence = 10 # Block all security risks - filters = ["dns"] - traffic = "any(dns.security_category[*] in {178 80 83 176 175 117 131 134 151 153 68})" - action = "block" + filters = ["dns"] + traffic = "any(dns.security_category[*] in {178 80 83 176 175 117 131 134 151 153 68})" + action = "block" rule_settings = { block_page_enabled = true @@ -37,18 +35,16 @@ locals { } resource "cloudflare_zero_trust_gateway_policy" "block_ads" { - account_id = local.cloudflare_account_id - + account_id = local.cloudflare_account_id name = "Block Ads" description = "Block Ads domains" - - enabled = true - precedence = 11 + enabled = true + precedence = 11 # Block domain belonging to lists (defined below) - filters = ["dns"] - action = "block" - traffic = local.ads_ad_filter + filters = ["dns"] + 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 != ""]