cloudflare.Filter
Explore with Pulumi AI
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.
cloudflare.Filter
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 thecloudflare.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 wordpress = new cloudflare.Filter("wordpress", {
zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
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",
});
import pulumi
import pulumi_cloudflare as cloudflare
wordpress = cloudflare.Filter("wordpress",
zone_id="0da42c8d2132a9ddaf714f9e7c920711",
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")
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{
ZoneId: pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
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"),
})
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 wordpress = new Cloudflare.Filter("wordpress", new()
{
ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
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",
});
});
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()
.zoneId("0da42c8d2132a9ddaf714f9e7c920711")
.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")
.build());
}
}
resources:
wordpress:
type: cloudflare:Filter
properties:
zoneId: 0da42c8d2132a9ddaf714f9e7c920711
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
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,
description: Optional[str] = None,
paused: Optional[bool] = None,
ref: 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",
Description = "string",
Paused = false,
Ref = "string",
});
example, err := cloudflare.NewFilter(ctx, "filterResource", &cloudflare.FilterArgs{
Expression: pulumi.String("string"),
ZoneId: pulumi.String("string"),
Description: pulumi.String("string"),
Paused: pulumi.Bool(false),
Ref: pulumi.String("string"),
})
var filterResource = new Filter("filterResource", FilterArgs.builder()
.expression("string")
.zoneId("string")
.description("string")
.paused(false)
.ref("string")
.build());
filter_resource = cloudflare.Filter("filterResource",
expression="string",
zone_id="string",
description="string",
paused=False,
ref="string")
const filterResource = new cloudflare.Filter("filterResource", {
expression: "string",
zoneId: "string",
description: "string",
paused: false,
ref: "string",
});
type: cloudflare:Filter
properties:
description: string
expression: string
paused: false
ref: 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
The Filter resource accepts the following input properties:
- Expression string
- The filter expression to be used.
- Zone
Id 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.
- Zone
Id 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.
- zone
Id 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.
- zone
Id 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.
- zone
Id 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.
- 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.
- Zone
Id 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.
- Zone
Id 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.
- zone
Id 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.
- zone
Id 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.
- zone
Id 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>
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.