Terraform cloudflare_ruleset

Trying to configure two rules. First goes through, but second one fails: “failed to create ruleset “http_request_firewall_custom” as a similar configuration with rules already exists and overwriting will have unintended consequences.”

This works:
resource “cloudflare_ruleset” “CountryBlock” {
zone_id = var.zone_id
name = “CountryBlock”
description = “Geo-filter ruleset”
kind = “zone”
phase = “http_request_firewall_custom”

rules {
action = “block”
expression = “(ip.geoip.country eq "") or (ip.geoip.country eq "")”
description = “Blocks requests from ***”
enabled = true
}
}

This doesn’t:
resource “cloudflare_ruleset” “IP_Reputation” {
zone_id = var.zone_id
name = “IPReputation”
description = “IP reputation ruleset”
kind = “custom”
phase = “http_request_firewall_custom”

rules {
action = “block”
expression = “(ip.geoip.country in {"" "" "" ""}) and cf.threat_score > ***”
description = “Blocks requests that have a high threat score”
enabled = true
}
}

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.