https://pulumi.com logo
#general
Title
# general
r

rich-painter-47009

02/14/2024, 11:47 AM
Hi, I am using
pulumi
to create cloudflare rate limit rule. here is my code:
Copy code
export const rateLimitRule = new cloudflare.RateLimit("rate-limit-rule", {
    zoneId: <zone-id>,
    threshold: 1200,
    period: 60, // Time period in seconds to evaluate request count (60 seconds = 1 minute)
    action: {
        mode: "ban",
        timeout: 60,
        response: {
            contentType: "text/plain",
            body: "Exceeded rate limit",
        },
    },
    match: {
        request: {
            urlPattern: "<http://test.example.com|test.example.com>",
        },
    },
});
I am using cloudflare
pro
plan and I can create the same rule in cloudflare dashboard. but I get
error creating rate limit for zone: ratelimit.api.not_entitled.account (10021)
which seems I am doing something that is not available in
pro
plan. can some one help me here? Thanks
q

quiet-answer-18749

02/14/2024, 10:16 PM
Hi Hasan, the RateLimit resource relates to the legacy cloudflare ratelimiting rules, which requires enterprise and cloudflare support to reenable it https://developers.cloudflare.com/waf/reference/legacy/old-rate-limiting/troubleshooting/. To use the new WAF rate limiting rules, you'll need to use the Ruleset resource https://www.pulumi.com/registry/packages/cloudflare/api-docs/ruleset/
r

rich-painter-47009

02/14/2024, 10:18 PM
Hi Alice, Thanks for your help 🙏 I will try it.