cloudflare logo
Cloudflare v5.0.0, Mar 13 23

cloudflare.Filter

Filter expressions that can be referenced across multiple features, e.g. Firewall Rules. See what is a filter for more details and available fields and operators.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;

return await Deployment.RunAsync(() => 
{
    var wordpress = new Cloudflare.Filter("wordpress", new()
    {
        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 = "0da42c8d2132a9ddaf714f9e7c920711",
    });

});
package main

import (
	"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.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("0da42c8d2132a9ddaf714f9e7c920711"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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 wordpress = new Filter("wordpress", FilterArgs.builder()        
            .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("0da42c8d2132a9ddaf714f9e7c920711")
            .build());

    }
}
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="0da42c8d2132a9ddaf714f9e7c920711")
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: "0da42c8d2132a9ddaf714f9e7c920711",
});
resources:
  wordpress:
    type: cloudflare:Filter
    properties:
      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: 0da42c8d2132a9ddaf714f9e7c920711

Create Filter Resource

new Filter(name: string, args: FilterArgs, opts?: CustomResourceOptions);
@overload
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)
@overload
def Filter(resource_name: str,
           args: FilterArgs,
           opts: Optional[ResourceOptions] = 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.

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.

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

The Filter resource accepts the following input properties:

Expression string

The filter expression to be used.

ZoneId string

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

Description string

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

Paused bool

Whether this filter is currently paused.

Ref string

Short reference tag to quickly select related rules.

Expression string

The filter expression to be used.

ZoneId string

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

Description string

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

Paused bool

Whether this filter is currently paused.

Ref string

Short reference tag to quickly select related rules.

expression String

The filter expression to be used.

zoneId String

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

description String

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

paused Boolean

Whether this filter is currently paused.

ref String

Short reference tag to quickly select related rules.

expression string

The filter expression to be used.

zoneId string

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

description string

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

paused boolean

Whether this filter is currently paused.

ref string

Short reference tag to quickly select related rules.

expression str

The filter expression to be used.

zone_id str

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

description str

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

paused bool

Whether this filter is currently paused.

ref str

Short reference tag to quickly select related rules.

expression String

The filter expression to be used.

zoneId String

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

description String

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

paused Boolean

Whether this filter is currently paused.

ref String

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 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 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)
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:
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.

Ref string

Short reference tag to quickly select related rules.

ZoneId string

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

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.

Ref string

Short reference tag to quickly select related rules.

ZoneId string

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

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.

ref String

Short reference tag to quickly select related rules.

zoneId String

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

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.

ref string

Short reference tag to quickly select related rules.

zoneId string

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

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.

ref str

Short reference tag to quickly select related rules.

zone_id str

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

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.

ref String

Short reference tag to quickly select related rules.

zoneId String

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.

Import

 $ pulumi import cloudflare:index/filter:Filter example <zone_id>/<filter_id>

Package Details

Repository
Cloudflare pulumi/pulumi-cloudflare
License
Apache-2.0
Notes

This Pulumi package is based on the cloudflare Terraform Provider.