1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. RateLimit
Cloudflare v5.43.0 published on Wednesday, Nov 13, 2024 by Pulumi

cloudflare.RateLimit

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.43.0 published on Wednesday, Nov 13, 2024 by Pulumi

    Provides a Cloudflare rate limit resource for a given zone. This can be used to limit the traffic you receive zone-wide, or matching more specific types of requests/responses.

    cloudflare.RateLimit is in a deprecation phase until January 15th, 2025. During this time period, this resource is still fully supported but you are strongly advised to move to the cloudflare.Ruleset resource. Full details can be found in the developer documentation.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    const example = new cloudflare.RateLimit("example", {
        zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
        threshold: 2000,
        period: 2,
        match: {
            request: {
                urlPattern: `${cloudflareZone}/*`,
                schemes: [
                    "HTTP",
                    "HTTPS",
                ],
                methods: [
                    "GET",
                    "POST",
                    "PUT",
                    "DELETE",
                    "PATCH",
                    "HEAD",
                ],
            },
            response: {
                statuses: [
                    200,
                    201,
                    202,
                    301,
                    429,
                ],
                originTraffic: false,
                headers: [
                    {
                        name: "Host",
                        op: "eq",
                        value: "localhost",
                    },
                    {
                        name: "X-Example",
                        op: "ne",
                        value: "my-example",
                    },
                ],
            },
        },
        action: {
            mode: "simulate",
            timeout: 43200,
            response: {
                contentType: "text/plain",
                body: "custom response body",
            },
        },
        correlate: {
            by: "nat",
        },
        disabled: false,
        description: "example rate limit for a zone",
        bypassUrlPatterns: [
            "example.com/bypass1",
            "example.com/bypass2",
        ],
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    example = cloudflare.RateLimit("example",
        zone_id="0da42c8d2132a9ddaf714f9e7c920711",
        threshold=2000,
        period=2,
        match={
            "request": {
                "url_pattern": f"{cloudflare_zone}/*",
                "schemes": [
                    "HTTP",
                    "HTTPS",
                ],
                "methods": [
                    "GET",
                    "POST",
                    "PUT",
                    "DELETE",
                    "PATCH",
                    "HEAD",
                ],
            },
            "response": {
                "statuses": [
                    200,
                    201,
                    202,
                    301,
                    429,
                ],
                "origin_traffic": False,
                "headers": [
                    {
                        "name": "Host",
                        "op": "eq",
                        "value": "localhost",
                    },
                    {
                        "name": "X-Example",
                        "op": "ne",
                        "value": "my-example",
                    },
                ],
            },
        },
        action={
            "mode": "simulate",
            "timeout": 43200,
            "response": {
                "content_type": "text/plain",
                "body": "custom response body",
            },
        },
        correlate={
            "by": "nat",
        },
        disabled=False,
        description="example rate limit for a zone",
        bypass_url_patterns=[
            "example.com/bypass1",
            "example.com/bypass2",
        ])
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudflare.NewRateLimit(ctx, "example", &cloudflare.RateLimitArgs{
    			ZoneId:    pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
    			Threshold: pulumi.Int(2000),
    			Period:    pulumi.Int(2),
    			Match: &cloudflare.RateLimitMatchArgs{
    				Request: &cloudflare.RateLimitMatchRequestArgs{
    					UrlPattern: pulumi.Sprintf("%v/*", cloudflareZone),
    					Schemes: pulumi.StringArray{
    						pulumi.String("HTTP"),
    						pulumi.String("HTTPS"),
    					},
    					Methods: pulumi.StringArray{
    						pulumi.String("GET"),
    						pulumi.String("POST"),
    						pulumi.String("PUT"),
    						pulumi.String("DELETE"),
    						pulumi.String("PATCH"),
    						pulumi.String("HEAD"),
    					},
    				},
    				Response: &cloudflare.RateLimitMatchResponseArgs{
    					Statuses: pulumi.IntArray{
    						pulumi.Int(200),
    						pulumi.Int(201),
    						pulumi.Int(202),
    						pulumi.Int(301),
    						pulumi.Int(429),
    					},
    					OriginTraffic: pulumi.Bool(false),
    					Headers: pulumi.StringMapArray{
    						pulumi.StringMap{
    							"name":  pulumi.String("Host"),
    							"op":    pulumi.String("eq"),
    							"value": pulumi.String("localhost"),
    						},
    						pulumi.StringMap{
    							"name":  pulumi.String("X-Example"),
    							"op":    pulumi.String("ne"),
    							"value": pulumi.String("my-example"),
    						},
    					},
    				},
    			},
    			Action: &cloudflare.RateLimitActionArgs{
    				Mode:    pulumi.String("simulate"),
    				Timeout: pulumi.Int(43200),
    				Response: &cloudflare.RateLimitActionResponseArgs{
    					ContentType: pulumi.String("text/plain"),
    					Body:        pulumi.String("custom response body"),
    				},
    			},
    			Correlate: &cloudflare.RateLimitCorrelateArgs{
    				By: pulumi.String("nat"),
    			},
    			Disabled:    pulumi.Bool(false),
    			Description: pulumi.String("example rate limit for a zone"),
    			BypassUrlPatterns: pulumi.StringArray{
    				pulumi.String("example.com/bypass1"),
    				pulumi.String("example.com/bypass2"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Cloudflare.RateLimit("example", new()
        {
            ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
            Threshold = 2000,
            Period = 2,
            Match = new Cloudflare.Inputs.RateLimitMatchArgs
            {
                Request = new Cloudflare.Inputs.RateLimitMatchRequestArgs
                {
                    UrlPattern = $"{cloudflareZone}/*",
                    Schemes = new[]
                    {
                        "HTTP",
                        "HTTPS",
                    },
                    Methods = new[]
                    {
                        "GET",
                        "POST",
                        "PUT",
                        "DELETE",
                        "PATCH",
                        "HEAD",
                    },
                },
                Response = new Cloudflare.Inputs.RateLimitMatchResponseArgs
                {
                    Statuses = new[]
                    {
                        200,
                        201,
                        202,
                        301,
                        429,
                    },
                    OriginTraffic = false,
                    Headers = new[]
                    {
                        
                        {
                            { "name", "Host" },
                            { "op", "eq" },
                            { "value", "localhost" },
                        },
                        
                        {
                            { "name", "X-Example" },
                            { "op", "ne" },
                            { "value", "my-example" },
                        },
                    },
                },
            },
            Action = new Cloudflare.Inputs.RateLimitActionArgs
            {
                Mode = "simulate",
                Timeout = 43200,
                Response = new Cloudflare.Inputs.RateLimitActionResponseArgs
                {
                    ContentType = "text/plain",
                    Body = "custom response body",
                },
            },
            Correlate = new Cloudflare.Inputs.RateLimitCorrelateArgs
            {
                By = "nat",
            },
            Disabled = false,
            Description = "example rate limit for a zone",
            BypassUrlPatterns = new[]
            {
                "example.com/bypass1",
                "example.com/bypass2",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.RateLimit;
    import com.pulumi.cloudflare.RateLimitArgs;
    import com.pulumi.cloudflare.inputs.RateLimitMatchArgs;
    import com.pulumi.cloudflare.inputs.RateLimitMatchRequestArgs;
    import com.pulumi.cloudflare.inputs.RateLimitMatchResponseArgs;
    import com.pulumi.cloudflare.inputs.RateLimitActionArgs;
    import com.pulumi.cloudflare.inputs.RateLimitActionResponseArgs;
    import com.pulumi.cloudflare.inputs.RateLimitCorrelateArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new RateLimit("example", RateLimitArgs.builder()
                .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
                .threshold(2000)
                .period(2)
                .match(RateLimitMatchArgs.builder()
                    .request(RateLimitMatchRequestArgs.builder()
                        .urlPattern(String.format("%s/*", cloudflareZone))
                        .schemes(                    
                            "HTTP",
                            "HTTPS")
                        .methods(                    
                            "GET",
                            "POST",
                            "PUT",
                            "DELETE",
                            "PATCH",
                            "HEAD")
                        .build())
                    .response(RateLimitMatchResponseArgs.builder()
                        .statuses(                    
                            200,
                            201,
                            202,
                            301,
                            429)
                        .originTraffic(false)
                        .headers(                    
                            Map.ofEntries(
                                Map.entry("name", "Host"),
                                Map.entry("op", "eq"),
                                Map.entry("value", "localhost")
                            ),
                            Map.ofEntries(
                                Map.entry("name", "X-Example"),
                                Map.entry("op", "ne"),
                                Map.entry("value", "my-example")
                            ))
                        .build())
                    .build())
                .action(RateLimitActionArgs.builder()
                    .mode("simulate")
                    .timeout(43200)
                    .response(RateLimitActionResponseArgs.builder()
                        .contentType("text/plain")
                        .body("custom response body")
                        .build())
                    .build())
                .correlate(RateLimitCorrelateArgs.builder()
                    .by("nat")
                    .build())
                .disabled(false)
                .description("example rate limit for a zone")
                .bypassUrlPatterns(            
                    "example.com/bypass1",
                    "example.com/bypass2")
                .build());
    
        }
    }
    
    resources:
      example:
        type: cloudflare:RateLimit
        properties:
          zoneId: 0da42c8d2132a9ddaf714f9e7c920711
          threshold: 2000
          period: 2
          match:
            request:
              urlPattern: ${cloudflareZone}/*
              schemes:
                - HTTP
                - HTTPS
              methods:
                - GET
                - POST
                - PUT
                - DELETE
                - PATCH
                - HEAD
            response:
              statuses:
                - 200
                - 201
                - 202
                - 301
                - 429
              originTraffic: false
              headers:
                - name: Host
                  op: eq
                  value: localhost
                - name: X-Example
                  op: ne
                  value: my-example
          action:
            mode: simulate
            timeout: 43200
            response:
              contentType: text/plain
              body: custom response body
          correlate:
            by: nat
          disabled: false
          description: example rate limit for a zone
          bypassUrlPatterns:
            - example.com/bypass1
            - example.com/bypass2
    

    Create RateLimit Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new RateLimit(name: string, args: RateLimitArgs, opts?: CustomResourceOptions);
    @overload
    def RateLimit(resource_name: str,
                  args: RateLimitArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def RateLimit(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  action: Optional[RateLimitActionArgs] = None,
                  period: Optional[int] = None,
                  threshold: Optional[int] = None,
                  zone_id: Optional[str] = None,
                  bypass_url_patterns: Optional[Sequence[str]] = None,
                  correlate: Optional[RateLimitCorrelateArgs] = None,
                  description: Optional[str] = None,
                  disabled: Optional[bool] = None,
                  match: Optional[RateLimitMatchArgs] = None)
    func NewRateLimit(ctx *Context, name string, args RateLimitArgs, opts ...ResourceOption) (*RateLimit, error)
    public RateLimit(string name, RateLimitArgs args, CustomResourceOptions? opts = null)
    public RateLimit(String name, RateLimitArgs args)
    public RateLimit(String name, RateLimitArgs args, CustomResourceOptions options)
    
    type: cloudflare:RateLimit
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args RateLimitArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args RateLimitArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args RateLimitArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RateLimitArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RateLimitArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var rateLimitResource = new Cloudflare.RateLimit("rateLimitResource", new()
    {
        Action = new Cloudflare.Inputs.RateLimitActionArgs
        {
            Mode = "string",
            Response = new Cloudflare.Inputs.RateLimitActionResponseArgs
            {
                Body = "string",
                ContentType = "string",
            },
            Timeout = 0,
        },
        Period = 0,
        Threshold = 0,
        ZoneId = "string",
        BypassUrlPatterns = new[]
        {
            "string",
        },
        Correlate = new Cloudflare.Inputs.RateLimitCorrelateArgs
        {
            By = "string",
        },
        Description = "string",
        Disabled = false,
        Match = new Cloudflare.Inputs.RateLimitMatchArgs
        {
            Request = new Cloudflare.Inputs.RateLimitMatchRequestArgs
            {
                Methods = new[]
                {
                    "string",
                },
                Schemes = new[]
                {
                    "string",
                },
                UrlPattern = "string",
            },
            Response = new Cloudflare.Inputs.RateLimitMatchResponseArgs
            {
                Headers = new[]
                {
                    
                    {
                        { "string", "string" },
                    },
                },
                OriginTraffic = false,
                Statuses = new[]
                {
                    0,
                },
            },
        },
    });
    
    example, err := cloudflare.NewRateLimit(ctx, "rateLimitResource", &cloudflare.RateLimitArgs{
    	Action: &cloudflare.RateLimitActionArgs{
    		Mode: pulumi.String("string"),
    		Response: &cloudflare.RateLimitActionResponseArgs{
    			Body:        pulumi.String("string"),
    			ContentType: pulumi.String("string"),
    		},
    		Timeout: pulumi.Int(0),
    	},
    	Period:    pulumi.Int(0),
    	Threshold: pulumi.Int(0),
    	ZoneId:    pulumi.String("string"),
    	BypassUrlPatterns: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Correlate: &cloudflare.RateLimitCorrelateArgs{
    		By: pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	Disabled:    pulumi.Bool(false),
    	Match: &cloudflare.RateLimitMatchArgs{
    		Request: &cloudflare.RateLimitMatchRequestArgs{
    			Methods: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			Schemes: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			UrlPattern: pulumi.String("string"),
    		},
    		Response: &cloudflare.RateLimitMatchResponseArgs{
    			Headers: pulumi.StringMapArray{
    				pulumi.StringMap{
    					"string": pulumi.String("string"),
    				},
    			},
    			OriginTraffic: pulumi.Bool(false),
    			Statuses: pulumi.IntArray{
    				pulumi.Int(0),
    			},
    		},
    	},
    })
    
    var rateLimitResource = new RateLimit("rateLimitResource", RateLimitArgs.builder()
        .action(RateLimitActionArgs.builder()
            .mode("string")
            .response(RateLimitActionResponseArgs.builder()
                .body("string")
                .contentType("string")
                .build())
            .timeout(0)
            .build())
        .period(0)
        .threshold(0)
        .zoneId("string")
        .bypassUrlPatterns("string")
        .correlate(RateLimitCorrelateArgs.builder()
            .by("string")
            .build())
        .description("string")
        .disabled(false)
        .match(RateLimitMatchArgs.builder()
            .request(RateLimitMatchRequestArgs.builder()
                .methods("string")
                .schemes("string")
                .urlPattern("string")
                .build())
            .response(RateLimitMatchResponseArgs.builder()
                .headers(Map.of("string", "string"))
                .originTraffic(false)
                .statuses(0)
                .build())
            .build())
        .build());
    
    rate_limit_resource = cloudflare.RateLimit("rateLimitResource",
        action={
            "mode": "string",
            "response": {
                "body": "string",
                "content_type": "string",
            },
            "timeout": 0,
        },
        period=0,
        threshold=0,
        zone_id="string",
        bypass_url_patterns=["string"],
        correlate={
            "by": "string",
        },
        description="string",
        disabled=False,
        match={
            "request": {
                "methods": ["string"],
                "schemes": ["string"],
                "url_pattern": "string",
            },
            "response": {
                "headers": [{
                    "string": "string",
                }],
                "origin_traffic": False,
                "statuses": [0],
            },
        })
    
    const rateLimitResource = new cloudflare.RateLimit("rateLimitResource", {
        action: {
            mode: "string",
            response: {
                body: "string",
                contentType: "string",
            },
            timeout: 0,
        },
        period: 0,
        threshold: 0,
        zoneId: "string",
        bypassUrlPatterns: ["string"],
        correlate: {
            by: "string",
        },
        description: "string",
        disabled: false,
        match: {
            request: {
                methods: ["string"],
                schemes: ["string"],
                urlPattern: "string",
            },
            response: {
                headers: [{
                    string: "string",
                }],
                originTraffic: false,
                statuses: [0],
            },
        },
    });
    
    type: cloudflare:RateLimit
    properties:
        action:
            mode: string
            response:
                body: string
                contentType: string
            timeout: 0
        bypassUrlPatterns:
            - string
        correlate:
            by: string
        description: string
        disabled: false
        match:
            request:
                methods:
                    - string
                schemes:
                    - string
                urlPattern: string
            response:
                headers:
                    - string: string
                originTraffic: false
                statuses:
                    - 0
        period: 0
        threshold: 0
        zoneId: string
    

    RateLimit Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The RateLimit resource accepts the following input properties:

    Action RateLimitAction
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    Period int
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    Threshold int
    The threshold that triggers the rate limit mitigations, combine with period.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    BypassUrlPatterns List<string>
    Correlate RateLimitCorrelate
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    Description string
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    Disabled bool
    Whether this ratelimit is currently disabled. Defaults to false.
    Match RateLimitMatch
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    Action RateLimitActionArgs
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    Period int
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    Threshold int
    The threshold that triggers the rate limit mitigations, combine with period.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    BypassUrlPatterns []string
    Correlate RateLimitCorrelateArgs
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    Description string
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    Disabled bool
    Whether this ratelimit is currently disabled. Defaults to false.
    Match RateLimitMatchArgs
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    action RateLimitAction
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    period Integer
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    threshold Integer
    The threshold that triggers the rate limit mitigations, combine with period.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    bypassUrlPatterns List<String>
    correlate RateLimitCorrelate
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    description String
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    disabled Boolean
    Whether this ratelimit is currently disabled. Defaults to false.
    match RateLimitMatch
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    action RateLimitAction
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    period number
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    threshold number
    The threshold that triggers the rate limit mitigations, combine with period.
    zoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    bypassUrlPatterns string[]
    correlate RateLimitCorrelate
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    description string
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    disabled boolean
    Whether this ratelimit is currently disabled. Defaults to false.
    match RateLimitMatch
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    action RateLimitActionArgs
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    period int
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    threshold int
    The threshold that triggers the rate limit mitigations, combine with period.
    zone_id str
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    bypass_url_patterns Sequence[str]
    correlate RateLimitCorrelateArgs
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    description str
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    disabled bool
    Whether this ratelimit is currently disabled. Defaults to false.
    match RateLimitMatchArgs
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    action Property Map
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    period Number
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    threshold Number
    The threshold that triggers the rate limit mitigations, combine with period.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    bypassUrlPatterns List<String>
    correlate Property Map
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    description String
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    disabled Boolean
    Whether this ratelimit is currently disabled. Defaults to false.
    match Property Map
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RateLimit resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing RateLimit Resource

    Get an existing RateLimit resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: RateLimitState, opts?: CustomResourceOptions): RateLimit
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            action: Optional[RateLimitActionArgs] = None,
            bypass_url_patterns: Optional[Sequence[str]] = None,
            correlate: Optional[RateLimitCorrelateArgs] = None,
            description: Optional[str] = None,
            disabled: Optional[bool] = None,
            match: Optional[RateLimitMatchArgs] = None,
            period: Optional[int] = None,
            threshold: Optional[int] = None,
            zone_id: Optional[str] = None) -> RateLimit
    func GetRateLimit(ctx *Context, name string, id IDInput, state *RateLimitState, opts ...ResourceOption) (*RateLimit, error)
    public static RateLimit Get(string name, Input<string> id, RateLimitState? state, CustomResourceOptions? opts = null)
    public static RateLimit get(String name, Output<String> id, RateLimitState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Action RateLimitAction
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    BypassUrlPatterns List<string>
    Correlate RateLimitCorrelate
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    Description string
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    Disabled bool
    Whether this ratelimit is currently disabled. Defaults to false.
    Match RateLimitMatch
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    Period int
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    Threshold int
    The threshold that triggers the rate limit mitigations, combine with period.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    Action RateLimitActionArgs
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    BypassUrlPatterns []string
    Correlate RateLimitCorrelateArgs
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    Description string
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    Disabled bool
    Whether this ratelimit is currently disabled. Defaults to false.
    Match RateLimitMatchArgs
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    Period int
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    Threshold int
    The threshold that triggers the rate limit mitigations, combine with period.
    ZoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    action RateLimitAction
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    bypassUrlPatterns List<String>
    correlate RateLimitCorrelate
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    description String
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    disabled Boolean
    Whether this ratelimit is currently disabled. Defaults to false.
    match RateLimitMatch
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    period Integer
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    threshold Integer
    The threshold that triggers the rate limit mitigations, combine with period.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    action RateLimitAction
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    bypassUrlPatterns string[]
    correlate RateLimitCorrelate
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    description string
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    disabled boolean
    Whether this ratelimit is currently disabled. Defaults to false.
    match RateLimitMatch
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    period number
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    threshold number
    The threshold that triggers the rate limit mitigations, combine with period.
    zoneId string
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    action RateLimitActionArgs
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    bypass_url_patterns Sequence[str]
    correlate RateLimitCorrelateArgs
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    description str
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    disabled bool
    Whether this ratelimit is currently disabled. Defaults to false.
    match RateLimitMatchArgs
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    period int
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    threshold int
    The threshold that triggers the rate limit mitigations, combine with period.
    zone_id str
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    action Property Map
    The action to be performed when the threshold of matched traffic within the period defined is exceeded.
    bypassUrlPatterns List<String>
    correlate Property Map
    Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.
    description String
    A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.
    disabled Boolean
    Whether this ratelimit is currently disabled. Defaults to false.
    match Property Map
    Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.
    period Number
    The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.
    threshold Number
    The threshold that triggers the rate limit mitigations, combine with period.
    zoneId String
    The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

    Supporting Types

    RateLimitAction, RateLimitActionArgs

    Mode string
    The type of action to perform. Available values: simulate, ban, challenge, js_challenge, managed_challenge.
    Response RateLimitActionResponse
    Custom content-type and body to return, this overrides the custom error for the zone. This field is not required. Omission will result in default HTML error page.
    Timeout int
    The time in seconds as an integer to perform the mitigation action. This field is required if the mode is either simulate or ban. Must be the same or greater than the period.
    Mode string
    The type of action to perform. Available values: simulate, ban, challenge, js_challenge, managed_challenge.
    Response RateLimitActionResponse
    Custom content-type and body to return, this overrides the custom error for the zone. This field is not required. Omission will result in default HTML error page.
    Timeout int
    The time in seconds as an integer to perform the mitigation action. This field is required if the mode is either simulate or ban. Must be the same or greater than the period.
    mode String
    The type of action to perform. Available values: simulate, ban, challenge, js_challenge, managed_challenge.
    response RateLimitActionResponse
    Custom content-type and body to return, this overrides the custom error for the zone. This field is not required. Omission will result in default HTML error page.
    timeout Integer
    The time in seconds as an integer to perform the mitigation action. This field is required if the mode is either simulate or ban. Must be the same or greater than the period.
    mode string
    The type of action to perform. Available values: simulate, ban, challenge, js_challenge, managed_challenge.
    response RateLimitActionResponse
    Custom content-type and body to return, this overrides the custom error for the zone. This field is not required. Omission will result in default HTML error page.
    timeout number
    The time in seconds as an integer to perform the mitigation action. This field is required if the mode is either simulate or ban. Must be the same or greater than the period.
    mode str
    The type of action to perform. Available values: simulate, ban, challenge, js_challenge, managed_challenge.
    response RateLimitActionResponse
    Custom content-type and body to return, this overrides the custom error for the zone. This field is not required. Omission will result in default HTML error page.
    timeout int
    The time in seconds as an integer to perform the mitigation action. This field is required if the mode is either simulate or ban. Must be the same or greater than the period.
    mode String
    The type of action to perform. Available values: simulate, ban, challenge, js_challenge, managed_challenge.
    response Property Map
    Custom content-type and body to return, this overrides the custom error for the zone. This field is not required. Omission will result in default HTML error page.
    timeout Number
    The time in seconds as an integer to perform the mitigation action. This field is required if the mode is either simulate or ban. Must be the same or greater than the period.

    RateLimitActionResponse, RateLimitActionResponseArgs

    Body string
    The body to return, the content here should conform to the content_type.
    ContentType string
    The content-type of the body. Available values: text/plain, text/xml, application/json.
    Body string
    The body to return, the content here should conform to the content_type.
    ContentType string
    The content-type of the body. Available values: text/plain, text/xml, application/json.
    body String
    The body to return, the content here should conform to the content_type.
    contentType String
    The content-type of the body. Available values: text/plain, text/xml, application/json.
    body string
    The body to return, the content here should conform to the content_type.
    contentType string
    The content-type of the body. Available values: text/plain, text/xml, application/json.
    body str
    The body to return, the content here should conform to the content_type.
    content_type str
    The content-type of the body. Available values: text/plain, text/xml, application/json.
    body String
    The body to return, the content here should conform to the content_type.
    contentType String
    The content-type of the body. Available values: text/plain, text/xml, application/json.

    RateLimitCorrelate, RateLimitCorrelateArgs

    By string
    If set to 'nat', NAT support will be enabled for rate limiting. Available values: nat.
    By string
    If set to 'nat', NAT support will be enabled for rate limiting. Available values: nat.
    by String
    If set to 'nat', NAT support will be enabled for rate limiting. Available values: nat.
    by string
    If set to 'nat', NAT support will be enabled for rate limiting. Available values: nat.
    by str
    If set to 'nat', NAT support will be enabled for rate limiting. Available values: nat.
    by String
    If set to 'nat', NAT support will be enabled for rate limiting. Available values: nat.

    RateLimitMatch, RateLimitMatchArgs

    Request RateLimitMatchRequest
    Matches HTTP requests (from the client to Cloudflare).
    Response RateLimitMatchResponse
    Matches HTTP responses before they are returned to the client from Cloudflare. If this is defined, then the entire counting of traffic occurs at this stage.
    Request RateLimitMatchRequest
    Matches HTTP requests (from the client to Cloudflare).
    Response RateLimitMatchResponse
    Matches HTTP responses before they are returned to the client from Cloudflare. If this is defined, then the entire counting of traffic occurs at this stage.
    request RateLimitMatchRequest
    Matches HTTP requests (from the client to Cloudflare).
    response RateLimitMatchResponse
    Matches HTTP responses before they are returned to the client from Cloudflare. If this is defined, then the entire counting of traffic occurs at this stage.
    request RateLimitMatchRequest
    Matches HTTP requests (from the client to Cloudflare).
    response RateLimitMatchResponse
    Matches HTTP responses before they are returned to the client from Cloudflare. If this is defined, then the entire counting of traffic occurs at this stage.
    request RateLimitMatchRequest
    Matches HTTP requests (from the client to Cloudflare).
    response RateLimitMatchResponse
    Matches HTTP responses before they are returned to the client from Cloudflare. If this is defined, then the entire counting of traffic occurs at this stage.
    request Property Map
    Matches HTTP requests (from the client to Cloudflare).
    response Property Map
    Matches HTTP responses before they are returned to the client from Cloudflare. If this is defined, then the entire counting of traffic occurs at this stage.

    RateLimitMatchRequest, RateLimitMatchRequestArgs

    Methods List<string>
    HTTP Methods to match traffic on. Available values: GET, POST, PUT, DELETE, PATCH, HEAD, _ALL_.
    Schemes List<string>
    HTTP schemes to match traffic on. Available values: HTTP, HTTPS, _ALL_.
    UrlPattern string
    The URL pattern to match comprised of the host and path, i.e. example.org/path. Wildcard are expanded to match applicable traffic, query strings are not matched. Use _ for all traffic to your zone.
    Methods []string
    HTTP Methods to match traffic on. Available values: GET, POST, PUT, DELETE, PATCH, HEAD, _ALL_.
    Schemes []string
    HTTP schemes to match traffic on. Available values: HTTP, HTTPS, _ALL_.
    UrlPattern string
    The URL pattern to match comprised of the host and path, i.e. example.org/path. Wildcard are expanded to match applicable traffic, query strings are not matched. Use _ for all traffic to your zone.
    methods List<String>
    HTTP Methods to match traffic on. Available values: GET, POST, PUT, DELETE, PATCH, HEAD, _ALL_.
    schemes List<String>
    HTTP schemes to match traffic on. Available values: HTTP, HTTPS, _ALL_.
    urlPattern String
    The URL pattern to match comprised of the host and path, i.e. example.org/path. Wildcard are expanded to match applicable traffic, query strings are not matched. Use _ for all traffic to your zone.
    methods string[]
    HTTP Methods to match traffic on. Available values: GET, POST, PUT, DELETE, PATCH, HEAD, _ALL_.
    schemes string[]
    HTTP schemes to match traffic on. Available values: HTTP, HTTPS, _ALL_.
    urlPattern string
    The URL pattern to match comprised of the host and path, i.e. example.org/path. Wildcard are expanded to match applicable traffic, query strings are not matched. Use _ for all traffic to your zone.
    methods Sequence[str]
    HTTP Methods to match traffic on. Available values: GET, POST, PUT, DELETE, PATCH, HEAD, _ALL_.
    schemes Sequence[str]
    HTTP schemes to match traffic on. Available values: HTTP, HTTPS, _ALL_.
    url_pattern str
    The URL pattern to match comprised of the host and path, i.e. example.org/path. Wildcard are expanded to match applicable traffic, query strings are not matched. Use _ for all traffic to your zone.
    methods List<String>
    HTTP Methods to match traffic on. Available values: GET, POST, PUT, DELETE, PATCH, HEAD, _ALL_.
    schemes List<String>
    HTTP schemes to match traffic on. Available values: HTTP, HTTPS, _ALL_.
    urlPattern String
    The URL pattern to match comprised of the host and path, i.e. example.org/path. Wildcard are expanded to match applicable traffic, query strings are not matched. Use _ for all traffic to your zone.

    RateLimitMatchResponse, RateLimitMatchResponseArgs

    Headers List<ImmutableDictionary<string, string>>
    List of HTTP headers maps to match the origin response on.
    OriginTraffic bool
    Only count traffic that has come from your origin servers. If true, cached items that Cloudflare serve will not count towards rate limiting.
    Statuses List<int>
    HTTP Status codes, can be one, many or indicate all by not providing this value.
    Headers []map[string]string
    List of HTTP headers maps to match the origin response on.
    OriginTraffic bool
    Only count traffic that has come from your origin servers. If true, cached items that Cloudflare serve will not count towards rate limiting.
    Statuses []int
    HTTP Status codes, can be one, many or indicate all by not providing this value.
    headers List<Map<String,String>>
    List of HTTP headers maps to match the origin response on.
    originTraffic Boolean
    Only count traffic that has come from your origin servers. If true, cached items that Cloudflare serve will not count towards rate limiting.
    statuses List<Integer>
    HTTP Status codes, can be one, many or indicate all by not providing this value.
    headers {[key: string]: string}[]
    List of HTTP headers maps to match the origin response on.
    originTraffic boolean
    Only count traffic that has come from your origin servers. If true, cached items that Cloudflare serve will not count towards rate limiting.
    statuses number[]
    HTTP Status codes, can be one, many or indicate all by not providing this value.
    headers Sequence[Mapping[str, str]]
    List of HTTP headers maps to match the origin response on.
    origin_traffic bool
    Only count traffic that has come from your origin servers. If true, cached items that Cloudflare serve will not count towards rate limiting.
    statuses Sequence[int]
    HTTP Status codes, can be one, many or indicate all by not providing this value.
    headers List<Map<String>>
    List of HTTP headers maps to match the origin response on.
    originTraffic Boolean
    Only count traffic that has come from your origin servers. If true, cached items that Cloudflare serve will not count towards rate limiting.
    statuses List<Number>
    HTTP Status codes, can be one, many or indicate all by not providing this value.

    Import

    $ pulumi import cloudflare:index/rateLimit:RateLimit example <zone_id>/<rate_limit_id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v5.43.0 published on Wednesday, Nov 13, 2024 by Pulumi