Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

Filter

Filter expressions that can be referenced across multiple features, e.g. Firewall Rule. The expression format is similar to Wireshark Display Filter.

Example Usage

using Pulumi;
using Cloudflare = Pulumi.Cloudflare;

class MyStack : Stack
{
    public MyStack()
    {
        var wordpress = new Cloudflare.Filter("wordpress", new Cloudflare.FilterArgs
        {
            Description = "Wordpress break-in attempts that are outside of the office",
            Expression = "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1",
            ZoneId = "d41d8cd98f00b204e9800998ecf8427e",
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-cloudflare/sdk/v2/go/cloudflare"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := cloudflare.NewFilter(ctx, "wordpress", &cloudflare.FilterArgs{
            Description: pulumi.String("Wordpress break-in attempts that are outside of the office"),
            Expression:  pulumi.String("(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1"),
            ZoneId:      pulumi.String("d41d8cd98f00b204e9800998ecf8427e"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_cloudflare as cloudflare

wordpress = cloudflare.Filter("wordpress",
    description="Wordpress break-in attempts that are outside of the office",
    expression="(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1",
    zone_id="d41d8cd98f00b204e9800998ecf8427e")
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";

const wordpress = new cloudflare.Filter("wordpress", {
    description: "Wordpress break-in attempts that are outside of the office",
    expression: "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1",
    zoneId: "d41d8cd98f00b204e9800998ecf8427e",
});

Create a Filter Resource

new Filter(name: string, args: FilterArgs, opts?: CustomResourceOptions);
def Filter(resource_name: 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)
func NewFilter(ctx *Context, name string, args FilterArgs, opts ...ResourceOption) (*Filter, error)
public Filter(string name, FilterArgs args, CustomResourceOptions? opts = null)
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.
opts ResourceOptions
A bag of options that control this 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.

Filter Resource Properties

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

Inputs

The Filter resource accepts the following input properties:

Expression string

The filter expression to be used.

ZoneId string

The DNS zone to which the Filter should be added.

Description string

A note that you can use to describe the purpose of the filter.

Paused bool

Whether this filter is currently paused. Boolean value.

Ref string

Short reference tag to quickly select related rules.

Expression string

The filter expression to be used.

ZoneId string

The DNS zone to which the Filter should be added.

Description string

A note that you can use to describe the purpose of the filter.

Paused bool

Whether this filter is currently paused. Boolean value.

Ref string

Short reference tag to quickly select related rules.

expression string

The filter expression to be used.

zoneId string

The DNS zone to which the Filter should be added.

description string

A note that you can use to describe the purpose of the filter.

paused boolean

Whether this filter is currently paused. Boolean value.

ref string

Short reference tag to quickly select related rules.

expression str

The filter expression to be used.

zone_id str

The DNS zone to which the Filter should be added.

description str

A note that you can use to describe the purpose of the filter.

paused bool

Whether this filter is currently paused. Boolean value.

ref str

Short reference tag to quickly select related rules.

Outputs

All input properties are implicitly available as output properties. Additionally, the Filter 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 str
The provider-assigned unique ID for this managed resource.

Look up an 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)
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.

The following state arguments are supported:

Description string

A note that you can use to describe the purpose of the filter.

Expression string

The filter expression to be used.

Paused bool

Whether this filter is currently paused. Boolean value.

Ref string

Short reference tag to quickly select related rules.

ZoneId string

The DNS zone to which the Filter should be added.

Description string

A note that you can use to describe the purpose of the filter.

Expression string

The filter expression to be used.

Paused bool

Whether this filter is currently paused. Boolean value.

Ref string

Short reference tag to quickly select related rules.

ZoneId string

The DNS zone to which the Filter should be added.

description string

A note that you can use to describe the purpose of the filter.

expression string

The filter expression to be used.

paused boolean

Whether this filter is currently paused. Boolean value.

ref string

Short reference tag to quickly select related rules.

zoneId string

The DNS zone to which the Filter should be added.

description str

A note that you can use to describe the purpose of the filter.

expression str

The filter expression to be used.

paused bool

Whether this filter is currently paused. Boolean value.

ref str

Short reference tag to quickly select related rules.

zone_id str

The DNS zone to which the Filter should be added.

Import

Filter can be imported using a composite ID formed of zone ID and filter ID, e.g.

 $ pulumi import cloudflare:index/filter:Filter default d41d8cd98f00b204e9800998ecf8427e/9e107d9d372bb6826bd81d3542a419d6

where* d41d8cd98f00b204e9800998ecf8427e - zone ID * 9e107d9d372bb6826bd81d3542a419d6 - filter ID as returned by API

Package Details

Repository
https://github.com/pulumi/pulumi-cloudflare
License
Apache-2.0
Notes
This Pulumi package is based on the cloudflare Terraform Provider.