published on Tuesday, Aug 25, 2026 by Pulumi
published on Tuesday, Aug 25, 2026 by Pulumi
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const examplePrecursor = new cloudflare.Precursor("example_precursor", {
zoneId: "023e105f4ecef8ad9ca31a8372d0c353",
defaultMode: "min-friction",
enforcementRules: [{
expression: "http.request.uri.path eq \"/login\"",
mode: "max-security",
description: "Ease friction on the login path",
enabled: true,
}],
});
import pulumi
import pulumi_cloudflare as cloudflare
example_precursor = cloudflare.Precursor("example_precursor",
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
default_mode="min-friction",
enforcement_rules=[{
"expression": "http.request.uri.path eq \"/login\"",
"mode": "max-security",
"description": "Ease friction on the login path",
"enabled": True,
}])
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.NewPrecursor(ctx, "example_precursor", &cloudflare.PrecursorArgs{
ZoneId: pulumi.String("023e105f4ecef8ad9ca31a8372d0c353"),
DefaultMode: pulumi.String("min-friction"),
EnforcementRules: cloudflare.PrecursorEnforcementRuleArray{
&cloudflare.PrecursorEnforcementRuleArgs{
Expression: pulumi.String("http.request.uri.path eq \"/login\""),
Mode: pulumi.String("max-security"),
Description: pulumi.String("Ease friction on the login path"),
Enabled: pulumi.Bool(true),
},
},
})
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 examplePrecursor = new Cloudflare.Precursor("example_precursor", new()
{
ZoneId = "023e105f4ecef8ad9ca31a8372d0c353",
DefaultMode = "min-friction",
EnforcementRules = new[]
{
new Cloudflare.Inputs.PrecursorEnforcementRuleArgs
{
Expression = "http.request.uri.path eq \"/login\"",
Mode = "max-security",
Description = "Ease friction on the login path",
Enabled = true,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.Precursor;
import com.pulumi.cloudflare.PrecursorArgs;
import com.pulumi.cloudflare.inputs.PrecursorEnforcementRuleArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 examplePrecursor = new Precursor("examplePrecursor", PrecursorArgs.builder()
.zoneId("023e105f4ecef8ad9ca31a8372d0c353")
.defaultMode("min-friction")
.enforcementRules(PrecursorEnforcementRuleArgs.builder()
.expression("http.request.uri.path eq \"/login\"")
.mode("max-security")
.description("Ease friction on the login path")
.enabled(true)
.build())
.build());
}
}
resources:
examplePrecursor:
type: cloudflare:Precursor
name: example_precursor
properties:
zoneId: 023e105f4ecef8ad9ca31a8372d0c353
defaultMode: min-friction
enforcementRules:
- expression: http.request.uri.path eq "/login"
mode: max-security
description: Ease friction on the login path
enabled: true
pulumi {
required_providers {
cloudflare = {
source = "pulumi/cloudflare"
}
}
}
resource "cloudflare_precursor" "example_precursor" {
zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
default_mode = "min-friction"
enforcement_rules {
expression = "http.request.uri.path eq \"/login\""
mode = "max-security"
description = "Ease friction on the login path"
enabled = true
}
}
Create Precursor Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Precursor(name: string, args: PrecursorArgs, opts?: CustomResourceOptions);@overload
def Precursor(resource_name: str,
args: PrecursorArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Precursor(resource_name: str,
opts: Optional[ResourceOptions] = None,
zone_id: Optional[str] = None,
default_mode: Optional[str] = None,
enforcement_rules: Optional[Sequence[PrecursorEnforcementRuleArgs]] = None)func NewPrecursor(ctx *Context, name string, args PrecursorArgs, opts ...ResourceOption) (*Precursor, error)public Precursor(string name, PrecursorArgs args, CustomResourceOptions? opts = null)
public Precursor(String name, PrecursorArgs args)
public Precursor(String name, PrecursorArgs args, CustomResourceOptions options)
type: cloudflare:Precursor
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "cloudflare_precursor" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args PrecursorArgs
- 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 PrecursorArgs
- 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 PrecursorArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PrecursorArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PrecursorArgs
- 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 precursorResource = new Cloudflare.Precursor("precursorResource", new()
{
ZoneId = "string",
DefaultMode = "string",
EnforcementRules = new[]
{
new Cloudflare.Inputs.PrecursorEnforcementRuleArgs
{
Expression = "string",
Mode = "string",
Description = "string",
Enabled = false,
Id = "string",
},
},
});
example, err := cloudflare.NewPrecursor(ctx, "precursorResource", &cloudflare.PrecursorArgs{
ZoneId: pulumi.String("string"),
DefaultMode: pulumi.String("string"),
EnforcementRules: cloudflare.PrecursorEnforcementRuleArray{
&cloudflare.PrecursorEnforcementRuleArgs{
Expression: pulumi.String("string"),
Mode: pulumi.String("string"),
Description: pulumi.String("string"),
Enabled: pulumi.Bool(false),
Id: pulumi.String("string"),
},
},
})
resource "cloudflare_precursor" "precursorResource" {
lifecycle {
create_before_destroy = true
}
zone_id = "string"
default_mode = "string"
enforcement_rules {
expression = "string"
mode = "string"
description = "string"
enabled = false
id = "string"
}
}
var precursorResource = new Precursor("precursorResource", PrecursorArgs.builder()
.zoneId("string")
.defaultMode("string")
.enforcementRules(PrecursorEnforcementRuleArgs.builder()
.expression("string")
.mode("string")
.description("string")
.enabled(false)
.id("string")
.build())
.build());
precursor_resource = cloudflare.Precursor("precursorResource",
zone_id="string",
default_mode="string",
enforcement_rules=[{
"expression": "string",
"mode": "string",
"description": "string",
"enabled": False,
"id": "string",
}])
const precursorResource = new cloudflare.Precursor("precursorResource", {
zoneId: "string",
defaultMode: "string",
enforcementRules: [{
expression: "string",
mode: "string",
description: "string",
enabled: false,
id: "string",
}],
});
type: cloudflare:Precursor
properties:
defaultMode: string
enforcementRules:
- description: string
enabled: false
expression: string
id: string
mode: string
zoneId: string
Precursor 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 Precursor resource accepts the following input properties:
- Zone
Id string - Identifier.
- Default
Mode string - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- Enforcement
Rules List<PrecursorEnforcement Rule> - The ordered list of enforcement rules for the zone.
- Zone
Id string - Identifier.
- Default
Mode string - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- Enforcement
Rules []PrecursorEnforcement Rule Args - The ordered list of enforcement rules for the zone.
- zone_
id string - Identifier.
- default_
mode string - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- enforcement_
rules list(object) - The ordered list of enforcement rules for the zone.
- zone
Id String - Identifier.
- default
Mode String - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- enforcement
Rules List<PrecursorEnforcement Rule> - The ordered list of enforcement rules for the zone.
- zone
Id string - Identifier.
- default
Mode string - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- enforcement
Rules PrecursorEnforcement Rule[] - The ordered list of enforcement rules for the zone.
- zone_
id str - Identifier.
- default_
mode str - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- enforcement_
rules Sequence[PrecursorEnforcement Rule Args] - The ordered list of enforcement rules for the zone.
- zone
Id String - Identifier.
- default
Mode String - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- enforcement
Rules List<Property Map> - The ordered list of enforcement rules for the zone.
Outputs
All input properties are implicitly available as output properties. Additionally, the Precursor 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 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 Precursor Resource
Get an existing Precursor 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?: PrecursorState, opts?: CustomResourceOptions): Precursor@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
default_mode: Optional[str] = None,
enforcement_rules: Optional[Sequence[PrecursorEnforcementRuleArgs]] = None,
zone_id: Optional[str] = None) -> Precursorfunc GetPrecursor(ctx *Context, name string, id IDInput, state *PrecursorState, opts ...ResourceOption) (*Precursor, error)public static Precursor Get(string name, Input<string> id, PrecursorState? state, CustomResourceOptions? opts = null)public static Precursor get(String name, Output<String> id, PrecursorState state, CustomResourceOptions options)resources: _: type: cloudflare:Precursor get: id: ${id}import {
to = cloudflare_precursor.example
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.
- Default
Mode string - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- Enforcement
Rules List<PrecursorEnforcement Rule> - The ordered list of enforcement rules for the zone.
- Zone
Id string - Identifier.
- Default
Mode string - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- Enforcement
Rules []PrecursorEnforcement Rule Args - The ordered list of enforcement rules for the zone.
- Zone
Id string - Identifier.
- default_
mode string - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- enforcement_
rules list(object) - The ordered list of enforcement rules for the zone.
- zone_
id string - Identifier.
- default
Mode String - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- enforcement
Rules List<PrecursorEnforcement Rule> - The ordered list of enforcement rules for the zone.
- zone
Id String - Identifier.
- default
Mode string - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- enforcement
Rules PrecursorEnforcement Rule[] - The ordered list of enforcement rules for the zone.
- zone
Id string - Identifier.
- default_
mode str - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- enforcement_
rules Sequence[PrecursorEnforcement Rule Args] - The ordered list of enforcement rules for the zone.
- zone_
id str - Identifier.
- default
Mode String - The zone-level Precursor enforcement mode applied to requests that do not match a more specific enforcement rule. Available values: "off", "min-friction", "max-security".
- enforcement
Rules List<Property Map> - The ordered list of enforcement rules for the zone.
- zone
Id String - Identifier.
Supporting Types
PrecursorEnforcementRule, PrecursorEnforcementRuleArgs
- Expression string
- The filter expression that determines which requests the rule matches.
- Mode string
- The override mode Precursor applies to requests matching an enforcement
rule. Unlike
defaultMode, this cannot beoff. Available values: "min-friction", "max-security". - Description string
- An informative description of the rule.
- Enabled bool
- Whether the rule is active.
- Id string
- The read-only identifier that Cloudflare assigns to the rule.
- Expression string
- The filter expression that determines which requests the rule matches.
- Mode string
- The override mode Precursor applies to requests matching an enforcement
rule. Unlike
defaultMode, this cannot beoff. Available values: "min-friction", "max-security". - Description string
- An informative description of the rule.
- Enabled bool
- Whether the rule is active.
- Id string
- The read-only identifier that Cloudflare assigns to the rule.
- expression string
- The filter expression that determines which requests the rule matches.
- mode string
- The override mode Precursor applies to requests matching an enforcement
rule. Unlike
defaultMode, this cannot beoff. Available values: "min-friction", "max-security". - description string
- An informative description of the rule.
- enabled bool
- Whether the rule is active.
- id string
- The read-only identifier that Cloudflare assigns to the rule.
- expression String
- The filter expression that determines which requests the rule matches.
- mode String
- The override mode Precursor applies to requests matching an enforcement
rule. Unlike
defaultMode, this cannot beoff. Available values: "min-friction", "max-security". - description String
- An informative description of the rule.
- enabled Boolean
- Whether the rule is active.
- id String
- The read-only identifier that Cloudflare assigns to the rule.
- expression string
- The filter expression that determines which requests the rule matches.
- mode string
- The override mode Precursor applies to requests matching an enforcement
rule. Unlike
defaultMode, this cannot beoff. Available values: "min-friction", "max-security". - description string
- An informative description of the rule.
- enabled boolean
- Whether the rule is active.
- id string
- The read-only identifier that Cloudflare assigns to the rule.
- expression str
- The filter expression that determines which requests the rule matches.
- mode str
- The override mode Precursor applies to requests matching an enforcement
rule. Unlike
defaultMode, this cannot beoff. Available values: "min-friction", "max-security". - description str
- An informative description of the rule.
- enabled bool
- Whether the rule is active.
- id str
- The read-only identifier that Cloudflare assigns to the rule.
- expression String
- The filter expression that determines which requests the rule matches.
- mode String
- The override mode Precursor applies to requests matching an enforcement
rule. Unlike
defaultMode, this cannot beoff. Available values: "min-friction", "max-security". - description String
- An informative description of the rule.
- enabled Boolean
- Whether the rule is active.
- id String
- The read-only identifier that Cloudflare assigns to the rule.
Import
$ pulumi import cloudflare:index/precursor:Precursor example '<zone_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
cloudflareTerraform Provider.
published on Tuesday, Aug 25, 2026 by Pulumi