1. Registry
  2. Packages
  3. Cloudflare Provider
  4. API Docs
  5. getSnippetRules
Viewing docs for Cloudflare v6.23.1
published on Wednesday, Oct 21, 2026 by Pulumi
cloudflare logo cloudflare logo
Viewing docs for Cloudflare v6.23.1
published on Wednesday, Oct 21, 2026 by Pulumi

    Accepted Permissions

    • Snippets Read
    • Snippets Write

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    const exampleSnippetRules = cloudflare.getSnippetRules({
        zoneId: "9f1839b6152d298aca64c4e906b6d074",
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    example_snippet_rules = cloudflare.get_snippet_rules(zone_id="9f1839b6152d298aca64c4e906b6d074")
    
    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.GetSnippetRules(ctx, &cloudflare.LookupSnippetRulesArgs{
    			ZoneId: "9f1839b6152d298aca64c4e906b6d074",
    		}, nil)
    		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 exampleSnippetRules = Cloudflare.GetSnippetRules.Invoke(new()
        {
            ZoneId = "9f1839b6152d298aca64c4e906b6d074",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.CloudflareFunctions;
    import com.pulumi.cloudflare.inputs.GetSnippetRulesArgs;
    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) {
            final var exampleSnippetRules = CloudflareFunctions.getSnippetRules(GetSnippetRulesArgs.builder()
                .zoneId("9f1839b6152d298aca64c4e906b6d074")
                .build());
    
        }
    }
    
    variables:
      exampleSnippetRules:
        fn::invoke:
          function: cloudflare:getSnippetRules
          arguments:
            zoneId: 9f1839b6152d298aca64c4e906b6d074
    
    terraform {
      required_providers {
        cloudflare = {
          source = "pulumi/cloudflare"
        }
      }
    }
    
    data "cloudflare_snippet_rules" "exampleSnippetRules" {
      zone_id = "9f1839b6152d298aca64c4e906b6d074"
    }
    

    Using getSnippetRules

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSnippetRules(args: GetSnippetRulesArgs, opts?: InvokeOptions): Promise<GetSnippetRulesResult>
    function getSnippetRulesOutput(args: GetSnippetRulesOutputArgs, opts?: InvokeOutputOptions): Output<GetSnippetRulesResult>
    def get_snippet_rules(zone_id: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetSnippetRulesResult
    def get_snippet_rules_output(zone_id: pulumi.Input[Optional[str]] = None,
                          opts: Optional[InvokeOutputOptions] = None) -> Output[GetSnippetRulesResult]
    func LookupSnippetRules(ctx *Context, args *LookupSnippetRulesArgs, opts ...InvokeOption) (*LookupSnippetRulesResult, error)
    func LookupSnippetRulesOutput(ctx *Context, args *LookupSnippetRulesOutputArgs, opts ...InvokeOption) LookupSnippetRulesResultOutput

    > Note: This function is named LookupSnippetRules in the Go SDK.

    public static class GetSnippetRules 
    {
        public static Task<GetSnippetRulesResult> InvokeAsync(GetSnippetRulesArgs args, InvokeOptions? opts = null)
        public static Output<GetSnippetRulesResult> Invoke(GetSnippetRulesInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetSnippetRulesResult> Invoke(GetSnippetRulesInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetSnippetRulesResult> getSnippetRules(GetSnippetRulesArgs args, InvokeOptions options)
    public static Output<GetSnippetRulesResult> getSnippetRules(GetSnippetRulesArgs args, InvokeOptions options)
    public static Output<GetSnippetRulesResult> getSnippetRules(GetSnippetRulesArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: cloudflare:index/getSnippetRules:getSnippetRules
      arguments:
        # arguments dictionary
    data "cloudflare_get_snippet_rules" "name" {
        # arguments
    }

    The following arguments are supported:

    ZoneId string
    Use this field to specify the unique ID of the zone.
    ZoneId string
    Use this field to specify the unique ID of the zone.
    zone_id string
    Use this field to specify the unique ID of the zone.
    zoneId String
    Use this field to specify the unique ID of the zone.
    zoneId string
    Use this field to specify the unique ID of the zone.
    zone_id str
    Use this field to specify the unique ID of the zone.
    zoneId String
    Use this field to specify the unique ID of the zone.

    getSnippetRules Result

    The following output properties are available:

    Id string
    Use this field to specify the unique ID of the zone.
    ZoneId string
    Use this field to specify the unique ID of the zone.
    Id string
    Use this field to specify the unique ID of the zone.
    ZoneId string
    Use this field to specify the unique ID of the zone.
    id string
    Use this field to specify the unique ID of the zone.
    zone_id string
    Use this field to specify the unique ID of the zone.
    id String
    Use this field to specify the unique ID of the zone.
    zoneId String
    Use this field to specify the unique ID of the zone.
    id string
    Use this field to specify the unique ID of the zone.
    zoneId string
    Use this field to specify the unique ID of the zone.
    id str
    Use this field to specify the unique ID of the zone.
    zone_id str
    Use this field to specify the unique ID of the zone.
    id String
    Use this field to specify the unique ID of the zone.
    zoneId String
    Use this field to specify the unique ID of the zone.

    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 logo
    Viewing docs for Cloudflare v6.23.1
    published on Wednesday, Oct 21, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial