1. Packages
  2. Fastly Provider
  3. API Docs
  4. getVclSnippets
Fastly v8.14.0 published on Monday, Feb 3, 2025 by Pulumi

fastly.getVclSnippets

Explore with Pulumi AI

Fastly v8.14.0 published on Monday, Feb 3, 2025 by Pulumi

VCL Snippets are blocks of VCL logic inserted into your service’s configuration that don’t require custom VCL.

Use this data source to get a list of Fastly VCL Snippets for the specified service/version.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as fastly from "@pulumi/fastly";

const exampleServiceVcl = new fastly.ServiceVcl("example", {
    name: "Example Service",
    domains: [{
        name: "example.com",
    }],
    forceDestroy: true,
});
const example = fastly.getVclSnippetsOutput({
    serviceId: exampleServiceVcl.id,
    serviceVersion: exampleServiceVcl.activeVersion,
});
export const serviceVclSnippets = example;
Copy
import pulumi
import pulumi_fastly as fastly

example_service_vcl = fastly.ServiceVcl("example",
    name="Example Service",
    domains=[{
        "name": "example.com",
    }],
    force_destroy=True)
example = fastly.get_vcl_snippets_output(service_id=example_service_vcl.id,
    service_version=example_service_vcl.active_version)
pulumi.export("serviceVclSnippets", example)
Copy
package main

import (
	"github.com/pulumi/pulumi-fastly/sdk/v8/go/fastly"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleServiceVcl, err := fastly.NewServiceVcl(ctx, "example", &fastly.ServiceVclArgs{
			Name: pulumi.String("Example Service"),
			Domains: fastly.ServiceVclDomainArray{
				&fastly.ServiceVclDomainArgs{
					Name: pulumi.String("example.com"),
				},
			},
			ForceDestroy: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		example := fastly.GetVclSnippetsOutput(ctx, fastly.GetVclSnippetsOutputArgs{
			ServiceId:      exampleServiceVcl.ID(),
			ServiceVersion: exampleServiceVcl.ActiveVersion,
		}, nil)
		ctx.Export("serviceVclSnippets", example)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Fastly = Pulumi.Fastly;

return await Deployment.RunAsync(() => 
{
    var exampleServiceVcl = new Fastly.ServiceVcl("example", new()
    {
        Name = "Example Service",
        Domains = new[]
        {
            new Fastly.Inputs.ServiceVclDomainArgs
            {
                Name = "example.com",
            },
        },
        ForceDestroy = true,
    });

    var example = Fastly.GetVclSnippets.Invoke(new()
    {
        ServiceId = exampleServiceVcl.Id,
        ServiceVersion = exampleServiceVcl.ActiveVersion,
    });

    return new Dictionary<string, object?>
    {
        ["serviceVclSnippets"] = example,
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.fastly.ServiceVcl;
import com.pulumi.fastly.ServiceVclArgs;
import com.pulumi.fastly.inputs.ServiceVclDomainArgs;
import com.pulumi.fastly.FastlyFunctions;
import com.pulumi.fastly.inputs.GetVclSnippetsArgs;
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) {
        var exampleServiceVcl = new ServiceVcl("exampleServiceVcl", ServiceVclArgs.builder()
            .name("Example Service")
            .domains(ServiceVclDomainArgs.builder()
                .name("example.com")
                .build())
            .forceDestroy(true)
            .build());

        final var example = FastlyFunctions.getVclSnippets(GetVclSnippetsArgs.builder()
            .serviceId(exampleServiceVcl.id())
            .serviceVersion(exampleServiceVcl.activeVersion())
            .build());

        ctx.export("serviceVclSnippets", example.applyValue(getVclSnippetsResult -> getVclSnippetsResult));
    }
}
Copy
resources:
  exampleServiceVcl:
    type: fastly:ServiceVcl
    name: example
    properties:
      name: Example Service
      domains:
        - name: example.com
      forceDestroy: true
variables:
  example:
    fn::invoke:
      function: fastly:getVclSnippets
      arguments:
        serviceId: ${exampleServiceVcl.id}
        serviceVersion: ${exampleServiceVcl.activeVersion}
outputs:
  serviceVclSnippets: ${example}
Copy

Using getVclSnippets

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 getVclSnippets(args: GetVclSnippetsArgs, opts?: InvokeOptions): Promise<GetVclSnippetsResult>
function getVclSnippetsOutput(args: GetVclSnippetsOutputArgs, opts?: InvokeOptions): Output<GetVclSnippetsResult>
Copy
def get_vcl_snippets(service_id: Optional[str] = None,
                     service_version: Optional[int] = None,
                     opts: Optional[InvokeOptions] = None) -> GetVclSnippetsResult
def get_vcl_snippets_output(service_id: Optional[pulumi.Input[str]] = None,
                     service_version: Optional[pulumi.Input[int]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetVclSnippetsResult]
Copy
func GetVclSnippets(ctx *Context, args *GetVclSnippetsArgs, opts ...InvokeOption) (*GetVclSnippetsResult, error)
func GetVclSnippetsOutput(ctx *Context, args *GetVclSnippetsOutputArgs, opts ...InvokeOption) GetVclSnippetsResultOutput
Copy

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

public static class GetVclSnippets 
{
    public static Task<GetVclSnippetsResult> InvokeAsync(GetVclSnippetsArgs args, InvokeOptions? opts = null)
    public static Output<GetVclSnippetsResult> Invoke(GetVclSnippetsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetVclSnippetsResult> getVclSnippets(GetVclSnippetsArgs args, InvokeOptions options)
public static Output<GetVclSnippetsResult> getVclSnippets(GetVclSnippetsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: fastly:index/getVclSnippets:getVclSnippets
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ServiceId This property is required. string
Alphanumeric string identifying the service.
ServiceVersion This property is required. int
Integer identifying a service version.
ServiceId This property is required. string
Alphanumeric string identifying the service.
ServiceVersion This property is required. int
Integer identifying a service version.
serviceId This property is required. String
Alphanumeric string identifying the service.
serviceVersion This property is required. Integer
Integer identifying a service version.
serviceId This property is required. string
Alphanumeric string identifying the service.
serviceVersion This property is required. number
Integer identifying a service version.
service_id This property is required. str
Alphanumeric string identifying the service.
service_version This property is required. int
Integer identifying a service version.
serviceId This property is required. String
Alphanumeric string identifying the service.
serviceVersion This property is required. Number
Integer identifying a service version.

getVclSnippets Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
ServiceId string
Alphanumeric string identifying the service.
ServiceVersion int
Integer identifying a service version.
VclSnippets List<GetVclSnippetsVclSnippet>
List of all VCL snippets for the version of the service.
Id string
The provider-assigned unique ID for this managed resource.
ServiceId string
Alphanumeric string identifying the service.
ServiceVersion int
Integer identifying a service version.
VclSnippets []GetVclSnippetsVclSnippet
List of all VCL snippets for the version of the service.
id String
The provider-assigned unique ID for this managed resource.
serviceId String
Alphanumeric string identifying the service.
serviceVersion Integer
Integer identifying a service version.
vclSnippets List<GetVclSnippetsVclSnippet>
List of all VCL snippets for the version of the service.
id string
The provider-assigned unique ID for this managed resource.
serviceId string
Alphanumeric string identifying the service.
serviceVersion number
Integer identifying a service version.
vclSnippets GetVclSnippetsVclSnippet[]
List of all VCL snippets for the version of the service.
id str
The provider-assigned unique ID for this managed resource.
service_id str
Alphanumeric string identifying the service.
service_version int
Integer identifying a service version.
vcl_snippets Sequence[GetVclSnippetsVclSnippet]
List of all VCL snippets for the version of the service.
id String
The provider-assigned unique ID for this managed resource.
serviceId String
Alphanumeric string identifying the service.
serviceVersion Number
Integer identifying a service version.
vclSnippets List<Property Map>
List of all VCL snippets for the version of the service.

Supporting Types

GetVclSnippetsVclSnippet

Content This property is required. string
The VCL code that specifies exactly what the snippet does.
Id This property is required. string
Alphanumeric string identifying a VCL Snippet.
Name This property is required. string
The name for the snippet.
Priority This property is required. int
Priority determines execution order. Lower numbers execute first.
Type This property is required. string
The location in generated VCL where the snippet should be placed.
Content This property is required. string
The VCL code that specifies exactly what the snippet does.
Id This property is required. string
Alphanumeric string identifying a VCL Snippet.
Name This property is required. string
The name for the snippet.
Priority This property is required. int
Priority determines execution order. Lower numbers execute first.
Type This property is required. string
The location in generated VCL where the snippet should be placed.
content This property is required. String
The VCL code that specifies exactly what the snippet does.
id This property is required. String
Alphanumeric string identifying a VCL Snippet.
name This property is required. String
The name for the snippet.
priority This property is required. Integer
Priority determines execution order. Lower numbers execute first.
type This property is required. String
The location in generated VCL where the snippet should be placed.
content This property is required. string
The VCL code that specifies exactly what the snippet does.
id This property is required. string
Alphanumeric string identifying a VCL Snippet.
name This property is required. string
The name for the snippet.
priority This property is required. number
Priority determines execution order. Lower numbers execute first.
type This property is required. string
The location in generated VCL where the snippet should be placed.
content This property is required. str
The VCL code that specifies exactly what the snippet does.
id This property is required. str
Alphanumeric string identifying a VCL Snippet.
name This property is required. str
The name for the snippet.
priority This property is required. int
Priority determines execution order. Lower numbers execute first.
type This property is required. str
The location in generated VCL where the snippet should be placed.
content This property is required. String
The VCL code that specifies exactly what the snippet does.
id This property is required. String
Alphanumeric string identifying a VCL Snippet.
name This property is required. String
The name for the snippet.
priority This property is required. Number
Priority determines execution order. Lower numbers execute first.
type This property is required. String
The location in generated VCL where the snippet should be placed.

Package Details

Repository
Fastly pulumi/pulumi-fastly
License
Apache-2.0
Notes
This Pulumi package is based on the fastly Terraform Provider.
Fastly v8.14.0 published on Monday, Feb 3, 2025 by Pulumi