1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. Filter
Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi

cloudflare.Filter

Explore with Pulumi AI

cloudflare logo
Cloudflare v6.1.2 published on Monday, Apr 28, 2025 by Pulumi

    cloudflare.Filter is in a deprecation phase until June 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 exampleFilter = new cloudflare.Filter("example_filter", {
        zoneId: "023e105f4ecef8ad9ca31a8372d0c353",
        expression: "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155",
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    example_filter = cloudflare.Filter("example_filter",
        zone_id="023e105f4ecef8ad9ca31a8372d0c353",
        expression="(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v6/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudflare.NewFilter(ctx, "example_filter", &cloudflare.FilterArgs{
    			ZoneId:     pulumi.String("023e105f4ecef8ad9ca31a8372d0c353"),
    			Expression: pulumi.String("(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155"),
    		})
    		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 exampleFilter = new Cloudflare.Filter("example_filter", new()
        {
            ZoneId = "023e105f4ecef8ad9ca31a8372d0c353",
            Expression = "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.Filter;
    import com.pulumi.cloudflare.FilterArgs;
    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 exampleFilter = new Filter("exampleFilter", FilterArgs.builder()
                .zoneId("023e105f4ecef8ad9ca31a8372d0c353")
                .expression("(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155")
                .build());
    
        }
    }
    
    resources:
      exampleFilter:
        type: cloudflare:Filter
        name: example_filter
        properties:
          zoneId: 023e105f4ecef8ad9ca31a8372d0c353
          expression: (http.request.uri.path ~ ".*wp-login.php" or http.request.uri.path ~ ".*xmlrpc.php") and ip.addr ne 172.16.22.155
    

    Create Filter Resource

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

    Constructor syntax

    new Filter(name: string, args: FilterArgs, opts?: CustomResourceOptions);
    @overload
    def Filter(resource_name: str,
               args: FilterArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Filter(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               expression: Optional[str] = None,
               zone_id: Optional[str] = None)
    func NewFilter(ctx *Context, name string, args FilterArgs, opts ...ResourceOption) (*Filter, error)
    public Filter(string name, FilterArgs args, CustomResourceOptions? opts = null)
    public Filter(String name, FilterArgs args)
    public Filter(String name, FilterArgs args, CustomResourceOptions options)
    
    type: cloudflare:Filter
    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 FilterArgs
    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 FilterArgs
    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 FilterArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FilterArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FilterArgs
    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 filterResource = new Cloudflare.Filter("filterResource", new()
    {
        Expression = "string",
        ZoneId = "string",
    });
    
    example, err := cloudflare.NewFilter(ctx, "filterResource", &cloudflare.FilterArgs{
    	Expression: pulumi.String("string"),
    	ZoneId:     pulumi.String("string"),
    })
    
    var filterResource = new Filter("filterResource", FilterArgs.builder()
        .expression("string")
        .zoneId("string")
        .build());
    
    filter_resource = cloudflare.Filter("filterResource",
        expression="string",
        zone_id="string")
    
    const filterResource = new cloudflare.Filter("filterResource", {
        expression: "string",
        zoneId: "string",
    });
    
    type: cloudflare:Filter
    properties:
        expression: string
        zoneId: string
    

    Filter 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 Filter resource accepts the following input properties:

    Expression string
    The filter expression. For more information, refer to Expressions.
    ZoneId string
    Identifier
    Expression string
    The filter expression. For more information, refer to Expressions.
    ZoneId string
    Identifier
    expression String
    The filter expression. For more information, refer to Expressions.
    zoneId String
    Identifier
    expression string
    The filter expression. For more information, refer to Expressions.
    zoneId string
    Identifier
    expression str
    The filter expression. For more information, refer to Expressions.
    zone_id str
    Identifier
    expression String
    The filter expression. For more information, refer to Expressions.
    zoneId String
    Identifier

    Outputs

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

    Description string
    An informative summary of the filter.
    Id string
    The provider-assigned unique ID for this managed resource.
    Paused bool
    When true, indicates that the filter is currently paused.
    Ref string
    A short reference tag. Allows you to select related filters.
    Description string
    An informative summary of the filter.
    Id string
    The provider-assigned unique ID for this managed resource.
    Paused bool
    When true, indicates that the filter is currently paused.
    Ref string
    A short reference tag. Allows you to select related filters.
    description String
    An informative summary of the filter.
    id String
    The provider-assigned unique ID for this managed resource.
    paused Boolean
    When true, indicates that the filter is currently paused.
    ref String
    A short reference tag. Allows you to select related filters.
    description string
    An informative summary of the filter.
    id string
    The provider-assigned unique ID for this managed resource.
    paused boolean
    When true, indicates that the filter is currently paused.
    ref string
    A short reference tag. Allows you to select related filters.
    description str
    An informative summary of the filter.
    id str
    The provider-assigned unique ID for this managed resource.
    paused bool
    When true, indicates that the filter is currently paused.
    ref str
    A short reference tag. Allows you to select related filters.
    description String
    An informative summary of the filter.
    id String
    The provider-assigned unique ID for this managed resource.
    paused Boolean
    When true, indicates that the filter is currently paused.
    ref String
    A short reference tag. Allows you to select related filters.

    Look up Existing Filter Resource

    Get an existing Filter 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?: FilterState, opts?: CustomResourceOptions): Filter
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            expression: Optional[str] = None,
            paused: Optional[bool] = None,
            ref: Optional[str] = None,
            zone_id: Optional[str] = None) -> Filter
    func GetFilter(ctx *Context, name string, id IDInput, state *FilterState, opts ...ResourceOption) (*Filter, error)
    public static Filter Get(string name, Input<string> id, FilterState? state, CustomResourceOptions? opts = null)
    public static Filter get(String name, Output<String> id, FilterState state, CustomResourceOptions options)
    resources:  _:    type: cloudflare:Filter    get:      id: ${id}
    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:
    Description string
    An informative summary of the filter.
    Expression string
    The filter expression. For more information, refer to Expressions.
    Paused bool
    When true, indicates that the filter is currently paused.
    Ref string
    A short reference tag. Allows you to select related filters.
    ZoneId string
    Identifier
    Description string
    An informative summary of the filter.
    Expression string
    The filter expression. For more information, refer to Expressions.
    Paused bool
    When true, indicates that the filter is currently paused.
    Ref string
    A short reference tag. Allows you to select related filters.
    ZoneId string
    Identifier
    description String
    An informative summary of the filter.
    expression String
    The filter expression. For more information, refer to Expressions.
    paused Boolean
    When true, indicates that the filter is currently paused.
    ref String
    A short reference tag. Allows you to select related filters.
    zoneId String
    Identifier
    description string
    An informative summary of the filter.
    expression string
    The filter expression. For more information, refer to Expressions.
    paused boolean
    When true, indicates that the filter is currently paused.
    ref string
    A short reference tag. Allows you to select related filters.
    zoneId string
    Identifier
    description str
    An informative summary of the filter.
    expression str
    The filter expression. For more information, refer to Expressions.
    paused bool
    When true, indicates that the filter is currently paused.
    ref str
    A short reference tag. Allows you to select related filters.
    zone_id str
    Identifier
    description String
    An informative summary of the filter.
    expression String
    The filter expression. For more information, refer to Expressions.
    paused Boolean
    When true, indicates that the filter is currently paused.
    ref String
    A short reference tag. Allows you to select related filters.
    zoneId String
    Identifier

    Import

    $ pulumi import cloudflare:index/filter:Filter example '<zone_id>/<filter_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 v6.1.2 published on Monday, Apr 28, 2025 by Pulumi