Cloudflare v6.8.0 published on Saturday, Aug 30, 2025 by Pulumi
cloudflare.getSnippet
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const exampleSnippet = cloudflare.getSnippet({
zoneId: "9f1839b6152d298aca64c4e906b6d074",
snippetName: "my_snippet",
});
import pulumi
import pulumi_cloudflare as cloudflare
example_snippet = cloudflare.get_snippet(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.LookupSnippet(ctx, &cloudflare.LookupSnippetArgs{
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 exampleSnippet = Cloudflare.GetSnippet.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.GetSnippetArgs;
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 exampleSnippet = CloudflareFunctions.getSnippet(GetSnippetArgs.builder()
.zoneId("9f1839b6152d298aca64c4e906b6d074")
.snippetName("my_snippet")
.build());
}
}
variables:
exampleSnippet:
fn::invoke:
function: cloudflare:getSnippet
arguments:
zoneId: 9f1839b6152d298aca64c4e906b6d074
snippetName: my_snippet
Using getSnippet
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 getSnippet(args: GetSnippetArgs, opts?: InvokeOptions): Promise<GetSnippetResult>
function getSnippetOutput(args: GetSnippetOutputArgs, opts?: InvokeOptions): Output<GetSnippetResult>
def get_snippet(snippet_name: Optional[str] = None,
zone_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSnippetResult
def get_snippet_output(snippet_name: Optional[pulumi.Input[str]] = None,
zone_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSnippetResult]
func LookupSnippet(ctx *Context, args *LookupSnippetArgs, opts ...InvokeOption) (*LookupSnippetResult, error)
func LookupSnippetOutput(ctx *Context, args *LookupSnippetOutputArgs, opts ...InvokeOption) LookupSnippetResultOutput
> Note: This function is named LookupSnippet
in the Go SDK.
public static class GetSnippet
{
public static Task<GetSnippetResult> InvokeAsync(GetSnippetArgs args, InvokeOptions? opts = null)
public static Output<GetSnippetResult> Invoke(GetSnippetInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSnippetResult> getSnippet(GetSnippetArgs args, InvokeOptions options)
public static Output<GetSnippetResult> getSnippet(GetSnippetArgs args, InvokeOptions options)
fn::invoke:
function: cloudflare:index/getSnippet:getSnippet
arguments:
# arguments dictionary
The following arguments are supported:
- Snippet
Name string - The identifying name of the snippet.
- Zone
Id string - The unique ID of the zone.
- Snippet
Name string - The identifying name of the snippet.
- Zone
Id string - The unique ID of the zone.
- snippet
Name String - The identifying name of the snippet.
- zone
Id String - The unique ID of the zone.
- snippet
Name string - The identifying name of the snippet.
- zone
Id 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.
- snippet
Name String - The identifying name of the snippet.
- zone
Id String - The unique ID of the zone.
getSnippet Result
The following output properties are available:
- Created
On string - The timestamp of when the snippet was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Modified
On string - The timestamp of when the snippet was last modified.
- Snippet
Name string - The identifying name of the snippet.
- Zone
Id string - The unique ID of the zone.
- Created
On string - The timestamp of when the snippet was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Modified
On string - The timestamp of when the snippet was last modified.
- Snippet
Name string - The identifying name of the snippet.
- Zone
Id string - The unique ID of the zone.
- created
On String - The timestamp of when the snippet was created.
- id String
- The provider-assigned unique ID for this managed resource.
- modified
On String - The timestamp of when the snippet was last modified.
- snippet
Name String - The identifying name of the snippet.
- zone
Id String - The unique ID of the zone.
- created
On string - The timestamp of when the snippet was created.
- id string
- The provider-assigned unique ID for this managed resource.
- modified
On string - The timestamp of when the snippet was last modified.
- snippet
Name string - The identifying name of the snippet.
- zone
Id 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.
- created
On String - The timestamp of when the snippet was created.
- id String
- The provider-assigned unique ID for this managed resource.
- modified
On String - The timestamp of when the snippet was last modified.
- snippet
Name String - The identifying name of the snippet.
- zone
Id 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.