I am trying to write a terraform script to apply a country block in Cloudflare for one of my websites. However, I am not entirely sure if I'm doing it right. For context this is using the Free Cloudflare plan.
My terraform script is below:
resource "cloudflare_ruleset" "country_block" {
zone_id = data.cloudflare_zone.zone.zone_id
name = "country block on ${local.web_host}"
kind = "zone"
phase = "http_request_firewall_custom"
rules {
action = "block"
expression = "(ip.geoip.country ne \"NZ\")"
enabled = true
}
}
The error I get is
Error: error creating ruleset country block on www.example.com: not entitled to use the firewall custom phase
I can do it manually in the CloudFlare portal, under the WAF Security - Firewall rules, you get 5 for free. So am assuming this is possible in terraform, thought the error potentially indicates a paid plan required