1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. SnippetRules
Cloudflare v6.9.0 published on Saturday, Sep 13, 2025 by Pulumi

cloudflare.SnippetRules

Explore with Pulumi AI

cloudflare logo
Cloudflare v6.9.0 published on Saturday, Sep 13, 2025 by Pulumi

    Example Usage

    Example coming soon!
    
    Example coming soon!
    
    Example coming soon!
    
    Example coming soon!
    
    Example coming soon!
    
    resources:
      exampleSnippetRules:
        type: cloudflare:SnippetRules
        name: example_snippet_rules
        properties:
          zoneId: 9f1839b6152d298aca64c4e906b6d074
          rules:
            - expression: ip.src eq 1.1.1.1
              snippet_name: my_snippet
              description: Execute my_snippet when IP address is 1.1.1.1.
              enabled: true
    

    Create SnippetRules Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new SnippetRules(name: string, args: SnippetRulesArgs, opts?: CustomResourceOptions);
    @overload
    def SnippetRules(resource_name: str,
                     args: SnippetRulesArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def SnippetRules(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     rules: Optional[Sequence[SnippetRulesRuleArgs]] = None,
                     zone_id: Optional[str] = None)
    func NewSnippetRules(ctx *Context, name string, args SnippetRulesArgs, opts ...ResourceOption) (*SnippetRules, error)
    public SnippetRules(string name, SnippetRulesArgs args, CustomResourceOptions? opts = null)
    public SnippetRules(String name, SnippetRulesArgs args)
    public SnippetRules(String name, SnippetRulesArgs args, CustomResourceOptions options)
    
    type: cloudflare:SnippetRules
    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 SnippetRulesArgs
    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 SnippetRulesArgs
    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 SnippetRulesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SnippetRulesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SnippetRulesArgs
    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 snippetRulesResource = new Cloudflare.SnippetRules("snippetRulesResource", new()
    {
        Rules = new[]
        {
            new Cloudflare.Inputs.SnippetRulesRuleArgs
            {
                Expression = "string",
                SnippetName = "string",
                Description = "string",
                Enabled = false,
                Id = "string",
                LastUpdated = "string",
            },
        },
        ZoneId = "string",
    });
    
    example, err := cloudflare.NewSnippetRules(ctx, "snippetRulesResource", &cloudflare.SnippetRulesArgs{
    	Rules: cloudflare.SnippetRulesRuleArray{
    		&cloudflare.SnippetRulesRuleArgs{
    			Expression:  pulumi.String("string"),
    			SnippetName: pulumi.String("string"),
    			Description: pulumi.String("string"),
    			Enabled:     pulumi.Bool(false),
    			Id:          pulumi.String("string"),
    			LastUpdated: pulumi.String("string"),
    		},
    	},
    	ZoneId: pulumi.String("string"),
    })
    
    var snippetRulesResource = new SnippetRules("snippetRulesResource", SnippetRulesArgs.builder()
        .rules(SnippetRulesRuleArgs.builder()
            .expression("string")
            .snippetName("string")
            .description("string")
            .enabled(false)
            .id("string")
            .lastUpdated("string")
            .build())
        .zoneId("string")
        .build());
    
    snippet_rules_resource = cloudflare.SnippetRules("snippetRulesResource",
        rules=[{
            "expression": "string",
            "snippet_name": "string",
            "description": "string",
            "enabled": False,
            "id": "string",
            "last_updated": "string",
        }],
        zone_id="string")
    
    const snippetRulesResource = new cloudflare.SnippetRules("snippetRulesResource", {
        rules: [{
            expression: "string",
            snippetName: "string",
            description: "string",
            enabled: false,
            id: "string",
            lastUpdated: "string",
        }],
        zoneId: "string",
    });
    
    type: cloudflare:SnippetRules
    properties:
        rules:
            - description: string
              enabled: false
              expression: string
              id: string
              lastUpdated: string
              snippetName: string
        zoneId: string
    

    SnippetRules 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 SnippetRules resource accepts the following input properties:

    Rules List<SnippetRulesRule>
    A list of snippet rules.
    ZoneId string
    The unique ID of the zone.
    Rules []SnippetRulesRuleArgs
    A list of snippet rules.
    ZoneId string
    The unique ID of the zone.
    rules List<SnippetRulesRule>
    A list of snippet rules.
    zoneId String
    The unique ID of the zone.
    rules SnippetRulesRule[]
    A list of snippet rules.
    zoneId string
    The unique ID of the zone.
    rules Sequence[SnippetRulesRuleArgs]
    A list of snippet rules.
    zone_id str
    The unique ID of the zone.
    rules List<Property Map>
    A list of snippet rules.
    zoneId String
    The unique ID of the zone.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SnippetRules 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 SnippetRules Resource

    Get an existing SnippetRules 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?: SnippetRulesState, opts?: CustomResourceOptions): SnippetRules
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            rules: Optional[Sequence[SnippetRulesRuleArgs]] = None,
            zone_id: Optional[str] = None) -> SnippetRules
    func GetSnippetRules(ctx *Context, name string, id IDInput, state *SnippetRulesState, opts ...ResourceOption) (*SnippetRules, error)
    public static SnippetRules Get(string name, Input<string> id, SnippetRulesState? state, CustomResourceOptions? opts = null)
    public static SnippetRules get(String name, Output<String> id, SnippetRulesState state, CustomResourceOptions options)
    resources:  _:    type: cloudflare:SnippetRules    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.
    The following state arguments are supported:
    Rules List<SnippetRulesRule>
    A list of snippet rules.
    ZoneId string
    The unique ID of the zone.
    Rules []SnippetRulesRuleArgs
    A list of snippet rules.
    ZoneId string
    The unique ID of the zone.
    rules List<SnippetRulesRule>
    A list of snippet rules.
    zoneId String
    The unique ID of the zone.
    rules SnippetRulesRule[]
    A list of snippet rules.
    zoneId string
    The unique ID of the zone.
    rules Sequence[SnippetRulesRuleArgs]
    A list of snippet rules.
    zone_id str
    The unique ID of the zone.
    rules List<Property Map>
    A list of snippet rules.
    zoneId String
    The unique ID of the zone.

    Supporting Types

    SnippetRulesRule, SnippetRulesRuleArgs

    Expression string
    The expression defining which traffic will match the rule.
    SnippetName string
    The identifying name of the snippet.
    Description string
    An informative description of the rule.
    Enabled bool
    Whether the rule should be executed.
    Id string
    The unique ID of the rule.
    LastUpdated string
    The timestamp of when the rule was last modified.
    Expression string
    The expression defining which traffic will match the rule.
    SnippetName string
    The identifying name of the snippet.
    Description string
    An informative description of the rule.
    Enabled bool
    Whether the rule should be executed.
    Id string
    The unique ID of the rule.
    LastUpdated string
    The timestamp of when the rule was last modified.
    expression String
    The expression defining which traffic will match the rule.
    snippetName String
    The identifying name of the snippet.
    description String
    An informative description of the rule.
    enabled Boolean
    Whether the rule should be executed.
    id String
    The unique ID of the rule.
    lastUpdated String
    The timestamp of when the rule was last modified.
    expression string
    The expression defining which traffic will match the rule.
    snippetName string
    The identifying name of the snippet.
    description string
    An informative description of the rule.
    enabled boolean
    Whether the rule should be executed.
    id string
    The unique ID of the rule.
    lastUpdated string
    The timestamp of when the rule was last modified.
    expression str
    The expression defining which traffic will match the rule.
    snippet_name str
    The identifying name of the snippet.
    description str
    An informative description of the rule.
    enabled bool
    Whether the rule should be executed.
    id str
    The unique ID of the rule.
    last_updated str
    The timestamp of when the rule was last modified.
    expression String
    The expression defining which traffic will match the rule.
    snippetName String
    The identifying name of the snippet.
    description String
    An informative description of the rule.
    enabled Boolean
    Whether the rule should be executed.
    id String
    The unique ID of the rule.
    lastUpdated String
    The timestamp of when the rule was last modified.

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v6.9.0 published on Saturday, Sep 13, 2025 by Pulumi