cloudflare.Filter
Explore with Pulumi AI
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 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 exampleFilter = new cloudflare.Filter("example_filter", {
zoneId: "023e105f4ecef8ad9ca31a8372d0c353",
bodies: [{
description: "Restrict access from these browsers on this address range.",
expression: "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155",
paused: false,
ref: "FIL-100",
}],
});
import pulumi
import pulumi_cloudflare as cloudflare
example_filter = cloudflare.Filter("example_filter",
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
bodies=[{
"description": "Restrict access from these browsers on this address range.",
"expression": "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155",
"paused": False,
"ref": "FIL-100",
}])
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"),
Bodies: cloudflare.FilterBodyArray{
&cloudflare.FilterBodyArgs{
Description: pulumi.String("Restrict access from these browsers on this address range."),
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"),
Paused: pulumi.Bool(false),
Ref: pulumi.String("FIL-100"),
},
},
})
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",
Bodies = new[]
{
new Cloudflare.Inputs.FilterBodyArgs
{
Description = "Restrict access from these browsers on this address range.",
Expression = "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155",
Paused = false,
Ref = "FIL-100",
},
},
});
});
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 com.pulumi.cloudflare.inputs.FilterBodyArgs;
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")
.bodies(FilterBodyArgs.builder()
.description("Restrict access from these browsers on this address range.")
.expression("(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155")
.paused(false)
.ref("FIL-100")
.build())
.build());
}
}
resources:
exampleFilter:
type: cloudflare:Filter
name: example_filter
properties:
zoneId: 023e105f4ecef8ad9ca31a8372d0c353
bodies:
- description: Restrict access from these browsers on this address range.
expression: (http.request.uri.path ~ ".*wp-login.php" or http.request.uri.path ~ ".*xmlrpc.php") and ip.addr ne 172.16.22.155
paused: false
ref: FIL-100
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,
bodies: Optional[Sequence[FilterBodyArgs]] = None,
zone_id: Optional[str] = None,
description: Optional[str] = None,
expression: 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()
{
Bodies = new[]
{
new Cloudflare.Inputs.FilterBodyArgs
{
Description = "string",
Expression = "string",
Id = "string",
Paused = false,
Ref = "string",
},
},
ZoneId = "string",
Description = "string",
Expression = "string",
Paused = false,
Ref = "string",
});
example, err := cloudflare.NewFilter(ctx, "filterResource", &cloudflare.FilterArgs{
Bodies: cloudflare.FilterBodyArray{
&cloudflare.FilterBodyArgs{
Description: pulumi.String("string"),
Expression: pulumi.String("string"),
Id: pulumi.String("string"),
Paused: pulumi.Bool(false),
Ref: pulumi.String("string"),
},
},
ZoneId: pulumi.String("string"),
Description: pulumi.String("string"),
Expression: pulumi.String("string"),
Paused: pulumi.Bool(false),
Ref: pulumi.String("string"),
})
var filterResource = new Filter("filterResource", FilterArgs.builder()
.bodies(FilterBodyArgs.builder()
.description("string")
.expression("string")
.id("string")
.paused(false)
.ref("string")
.build())
.zoneId("string")
.description("string")
.expression("string")
.paused(false)
.ref("string")
.build());
filter_resource = cloudflare.Filter("filterResource",
bodies=[{
"description": "string",
"expression": "string",
"id": "string",
"paused": False,
"ref": "string",
}],
zone_id="string",
description="string",
expression="string",
paused=False,
ref="string")
const filterResource = new cloudflare.Filter("filterResource", {
bodies: [{
description: "string",
expression: "string",
id: "string",
paused: false,
ref: "string",
}],
zoneId: "string",
description: "string",
expression: "string",
paused: false,
ref: "string",
});
type: cloudflare:Filter
properties:
bodies:
- description: string
expression: string
id: string
paused: false
ref: string
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
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:
- Bodies
List<Filter
Body> - Zone
Id string - Defines an 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.
- Bodies
[]Filter
Body Args - Zone
Id string - Defines an 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.
- bodies
List<Filter
Body> - zone
Id String - Defines an 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.
- bodies
Filter
Body[] - zone
Id string - Defines an 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.
- bodies
Sequence[Filter
Body Args] - zone_
id str - Defines an 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.
- bodies List<Property Map>
- zone
Id String - Defines an 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.
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,
bodies: Optional[Sequence[FilterBodyArgs]] = 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.
- Bodies
List<Filter
Body> - 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.
- Zone
Id string - Defines an identifier.
- Bodies
[]Filter
Body Args - 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.
- Zone
Id string - Defines an identifier.
- bodies
List<Filter
Body> - 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.
- zone
Id String - Defines an identifier.
- bodies
Filter
Body[] - 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.
- zone
Id string - Defines an identifier.
- bodies
Sequence[Filter
Body Args] - 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 - Defines an identifier.
- bodies List<Property Map>
- 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.
- zone
Id String - Defines an identifier.
Supporting Types
FilterBody, FilterBodyArgs
- Description string
- An informative summary of the filter.
- Expression string
- The filter expression. For more information, refer to Expressions.
- Id string
- The unique identifier of the filter.
- 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.
- Expression string
- The filter expression. For more information, refer to Expressions.
- Id string
- The unique identifier of the filter.
- 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.
- expression String
- The filter expression. For more information, refer to Expressions.
- id String
- The unique identifier of the filter.
- 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.
- expression string
- The filter expression. For more information, refer to Expressions.
- id string
- The unique identifier of the filter.
- 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.
- expression str
- The filter expression. For more information, refer to Expressions.
- id str
- The unique identifier of the filter.
- 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.
- expression String
- The filter expression. For more information, refer to Expressions.
- id String
- The unique identifier of the filter.
- paused Boolean
- When true, indicates that the filter is currently paused.
- ref String
- A short reference tag. Allows you to select related filters.
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.