1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. getSnippets
Cloudflare v6.6.0 published on Wednesday, Aug 20, 2025 by Pulumi

cloudflare.getSnippets

Explore with Pulumi AI

cloudflare logo
Cloudflare v6.6.0 published on Wednesday, Aug 20, 2025 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    const exampleSnippets = cloudflare.getSnippets({
        zoneId: "9f1839b6152d298aca64c4e906b6d074",
        snippetName: "my_snippet",
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    example_snippets = cloudflare.get_snippets(zone_id="9f1839b6152d298aca64c4e906b6d074",
        snippet_name="my_snippet")
    
    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.LookupSnippets(ctx, &cloudflare.LookupSnippetsArgs{
    			ZoneId:      "9f1839b6152d298aca64c4e906b6d074",
    			SnippetName: "my_snippet",
    		}, 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 exampleSnippets = Cloudflare.GetSnippets.Invoke(new()
        {
            ZoneId = "9f1839b6152d298aca64c4e906b6d074",
            SnippetName = "my_snippet",
        });
    
    });
    
    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.GetSnippetsArgs;
    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) {
            final var exampleSnippets = CloudflareFunctions.getSnippets(GetSnippetsArgs.builder()
                .zoneId("9f1839b6152d298aca64c4e906b6d074")
                .snippetName("my_snippet")
                .build());
    
        }
    }
    
    variables:
      exampleSnippets:
        fn::invoke:
          function: cloudflare:getSnippets
          arguments:
            zoneId: 9f1839b6152d298aca64c4e906b6d074
            snippetName: my_snippet
    

    Using getSnippets

    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 getSnippets(args: GetSnippetsArgs, opts?: InvokeOptions): Promise<GetSnippetsResult>
    function getSnippetsOutput(args: GetSnippetsOutputArgs, opts?: InvokeOptions): Output<GetSnippetsResult>
    def get_snippets(snippet_name: Optional[str] = None,
                     zone_id: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetSnippetsResult
    def get_snippets_output(snippet_name: Optional[pulumi.Input[str]] = None,
                     zone_id: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetSnippetsResult]
    func LookupSnippets(ctx *Context, args *LookupSnippetsArgs, opts ...InvokeOption) (*LookupSnippetsResult, error)
    func LookupSnippetsOutput(ctx *Context, args *LookupSnippetsOutputArgs, opts ...InvokeOption) LookupSnippetsResultOutput

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

    public static class GetSnippets 
    {
        public static Task<GetSnippetsResult> InvokeAsync(GetSnippetsArgs args, InvokeOptions? opts = null)
        public static Output<GetSnippetsResult> Invoke(GetSnippetsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSnippetsResult> getSnippets(GetSnippetsArgs args, InvokeOptions options)
    public static Output<GetSnippetsResult> getSnippets(GetSnippetsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: cloudflare:index/getSnippets:getSnippets
      arguments:
        # arguments dictionary

    The following arguments are supported:

    SnippetName string
    The identifying name of the snippet.
    ZoneId string
    The unique ID of the zone.
    SnippetName string
    The identifying name of the snippet.
    ZoneId string
    The unique ID of the zone.
    snippetName String
    The identifying name of the snippet.
    zoneId String
    The unique ID of the zone.
    snippetName string
    The identifying name of the snippet.
    zoneId string
    The unique ID of the zone.
    snippet_name str
    The identifying name of the snippet.
    zone_id str
    The unique ID of the zone.
    snippetName String
    The identifying name of the snippet.
    zoneId String
    The unique ID of the zone.

    getSnippets Result

    The following output properties are available:

    CreatedOn string
    The timestamp of when the snippet was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    ModifiedOn string
    The timestamp of when the snippet was last modified.
    SnippetName string
    The identifying name of the snippet.
    ZoneId string
    The unique ID of the zone.
    CreatedOn string
    The timestamp of when the snippet was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    ModifiedOn string
    The timestamp of when the snippet was last modified.
    SnippetName string
    The identifying name of the snippet.
    ZoneId string
    The unique ID of the zone.
    createdOn String
    The timestamp of when the snippet was created.
    id String
    The provider-assigned unique ID for this managed resource.
    modifiedOn String
    The timestamp of when the snippet was last modified.
    snippetName String
    The identifying name of the snippet.
    zoneId String
    The unique ID of the zone.
    createdOn string
    The timestamp of when the snippet was created.
    id string
    The provider-assigned unique ID for this managed resource.
    modifiedOn string
    The timestamp of when the snippet was last modified.
    snippetName string
    The identifying name of the snippet.
    zoneId string
    The unique ID of the zone.
    created_on str
    The timestamp of when the snippet was created.
    id str
    The provider-assigned unique ID for this managed resource.
    modified_on str
    The timestamp of when the snippet was last modified.
    snippet_name str
    The identifying name of the snippet.
    zone_id str
    The unique ID of the zone.
    createdOn String
    The timestamp of when the snippet was created.
    id String
    The provider-assigned unique ID for this managed resource.
    modifiedOn String
    The timestamp of when the snippet was last modified.
    snippetName String
    The identifying name of the snippet.
    zoneId String
    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 v6.6.0 published on Wednesday, Aug 20, 2025 by Pulumi