1. Packages
  2. Fastly Provider
  3. API Docs
  4. ServiceDynamicSnippetContent
Viewing docs for Fastly v11.4.1
published on Friday, Feb 27, 2026 by Pulumi
fastly logo
Viewing docs for Fastly v11.4.1
published on Friday, Feb 27, 2026 by Pulumi

    Defines content that represents blocks of VCL logic that is inserted into your service. This resource will populate the content of a dynamic snippet and allow it to be manged without the creation of a new service verison.

    Note: By default the Terraform provider allows you to externally manage the snippets via API or UI. If you wish to apply your changes in the HCL, then you should explicitly set the manage_snippets attribute. An example of this configuration is provided below.

    Example Usage

    Terraform >= 0.12.6)

    Basic usage:

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    const myservice = new fastly.ServiceVcl("myservice", {
        name: "snippet_test",
        domains: [{
            name: "snippet.fastlytestdomain.com",
            comment: "snippet test",
        }],
        backends: [{
            address: "http-me.fastly.dev",
            name: "Glitch Test Site",
            port: 80,
        }],
        dynamicsnippets: [{
            name: "My Dynamic Snippet",
            type: "recv",
            priority: 110,
        }],
        defaultHost: "http-me.fastly.dev",
        forceDestroy: true,
    });
    const myDynContent: fastly.ServiceDynamicSnippetContent[] = [];
    myservice.dynamicsnippets.apply(dynamicsnippets => {
        const myDynContent: fastly.ServiceDynamicSnippetContent[] = [];
    pulumi.all(.filter(d => d.name == "My Dynamic Snippet").reduce((__obj, d) => ({ ...__obj, [d.name]: d }))).apply(rangeBody => {
            for (const range of Object.entries(rangeBody).map(([k, v]) => ({key: k, value: v}))) {
                myDynContent.push(new fastly.ServiceDynamicSnippetContent(`my_dyn_content-${range.key}`, {
                    serviceId: myservice.id,
                    snippetId: range.value.snippetId,
                    content: `if ( req.url ) {
     set req.http.my-snippet-test-header = "true";
    }`,
                }));
            }
        });
    });
    
    import pulumi
    import pulumi_fastly as fastly
    
    myservice = fastly.ServiceVcl("myservice",
        name="snippet_test",
        domains=[{
            "name": "snippet.fastlytestdomain.com",
            "comment": "snippet test",
        }],
        backends=[{
            "address": "http-me.fastly.dev",
            "name": "Glitch Test Site",
            "port": 80,
        }],
        dynamicsnippets=[{
            "name": "My Dynamic Snippet",
            "type": "recv",
            "priority": 110,
        }],
        default_host="http-me.fastly.dev",
        force_destroy=True)
    my_dyn_content = []
    def create_my_dyn_content(range_body):
        for range in [{"key": k, "value": v} for [k, v] in enumerate(range_body)]:
            my_dyn_content.append(fastly.ServiceDynamicSnippetContent(f"my_dyn_content-{range['key']}",
                service_id=myservice.id,
                snippet_id=range["value"].snippet_id,
                content="""if ( req.url ) {
     set req.http.my-snippet-test-header = "true";
    }"""))
    
    myservice.dynamicsnippets.apply(lambda resolved_outputs: create_my_dyn_content({d.name: d for d in resolved_outputs['dynamicsnippets'] if d.name == "My Dynamic Snippet"}))
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        var myservice = new Fastly.ServiceVcl("myservice", new()
        {
            Name = "snippet_test",
            Domains = new[]
            {
                new Fastly.Inputs.ServiceVclDomainArgs
                {
                    Name = "snippet.fastlytestdomain.com",
                    Comment = "snippet test",
                },
            },
            Backends = new[]
            {
                new Fastly.Inputs.ServiceVclBackendArgs
                {
                    Address = "http-me.fastly.dev",
                    Name = "Glitch Test Site",
                    Port = 80,
                },
            },
            Dynamicsnippets = new[]
            {
                new Fastly.Inputs.ServiceVclDynamicsnippetArgs
                {
                    Name = "My Dynamic Snippet",
                    Type = "recv",
                    Priority = 110,
                },
            },
            DefaultHost = "http-me.fastly.dev",
            ForceDestroy = true,
        });
    
        var myDynContent = new List<Fastly.ServiceDynamicSnippetContent>();
        foreach (var range in myservice.Dynamicsnippets.Apply(dynamicsnippets => ).Select(pair => new { pair.Key, pair.Value }))
        {
            myDynContent.Add(new Fastly.ServiceDynamicSnippetContent($"my_dyn_content-{range.Key}", new()
            {
                ServiceId = myservice.Id,
                SnippetId = range.Value.SnippetId,
                Content = @"if ( req.url ) {
     set req.http.my-snippet-test-header = ""true"";
    }",
            }));
        }
    });
    
    Example coming soon!
    
    resources:
      myservice:
        type: fastly:ServiceVcl
        properties:
          name: snippet_test
          domains:
            - name: snippet.fastlytestdomain.com
              comment: snippet test
          backends:
            - address: http-me.fastly.dev
              name: Glitch Test Site
              port: 80
          dynamicsnippets:
            - name: My Dynamic Snippet
              type: recv
              priority: 110
          defaultHost: http-me.fastly.dev
          forceDestroy: true
      myDynContent:
        type: fastly:ServiceDynamicSnippetContent
        name: my_dyn_content
        properties:
          serviceId: ${myservice.id}
          snippetId: ${range.value.snippetId}
          content: |-
            if ( req.url ) {
             set req.http.my-snippet-test-header = "true";
            }
        options: {}
    

    Multiple dynamic snippets:

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    const myservice = new fastly.ServiceVcl("myservice", {
        name: "snippet_test",
        domains: [{
            name: "snippet.fastlytestdomain.com",
            comment: "snippet test",
        }],
        backends: [{
            address: "http-me.fastly.dev",
            name: "Glitch Test Site",
            port: 80,
        }],
        dynamicsnippets: [
            {
                name: "My Dynamic Snippet One",
                type: "recv",
                priority: 110,
            },
            {
                name: "My Dynamic Snippet Two",
                type: "recv",
                priority: 110,
            },
        ],
        defaultHost: "http-me.fastly.dev",
        forceDestroy: true,
    });
    const myDynContentOne: fastly.ServiceDynamicSnippetContent[] = [];
    myservice.dynamicsnippets.apply(dynamicsnippets => {
        const myDynContentOne: fastly.ServiceDynamicSnippetContent[] = [];
    pulumi.all(.filter(d => d.name == "My Dynamic Snippet One").reduce((__obj, d) => ({ ...__obj, [d.name]: d }))).apply(rangeBody => {
            for (const range of Object.entries(rangeBody).map(([k, v]) => ({key: k, value: v}))) {
                myDynContentOne.push(new fastly.ServiceDynamicSnippetContent(`my_dyn_content_one-${range.key}`, {
                    serviceId: myservice.id,
                    snippetId: range.value.snippetId,
                    content: `if ( req.url ) {
     set req.http.my-snippet-test-header-one = "true";
    }`,
                }));
            }
        });
    });
    const myDynContentTwo: fastly.ServiceDynamicSnippetContent[] = [];
    myservice.dynamicsnippets.apply(dynamicsnippets => {
        const myDynContentTwo: fastly.ServiceDynamicSnippetContent[] = [];
    pulumi.all(.filter(d => d.name == "My Dynamic Snippet Two").reduce((__obj, d) => ({ ...__obj, [d.name]: d }))).apply(rangeBody => {
            for (const range of Object.entries(rangeBody).map(([k, v]) => ({key: k, value: v}))) {
                myDynContentTwo.push(new fastly.ServiceDynamicSnippetContent(`my_dyn_content_two-${range.key}`, {
                    serviceId: myservice.id,
                    snippetId: range.value.snippetId,
                    content: `if ( req.url ) {
     set req.http.my-snippet-test-header-two = "true";
    }`,
                }));
            }
        });
    });
    
    import pulumi
    import pulumi_fastly as fastly
    
    myservice = fastly.ServiceVcl("myservice",
        name="snippet_test",
        domains=[{
            "name": "snippet.fastlytestdomain.com",
            "comment": "snippet test",
        }],
        backends=[{
            "address": "http-me.fastly.dev",
            "name": "Glitch Test Site",
            "port": 80,
        }],
        dynamicsnippets=[
            {
                "name": "My Dynamic Snippet One",
                "type": "recv",
                "priority": 110,
            },
            {
                "name": "My Dynamic Snippet Two",
                "type": "recv",
                "priority": 110,
            },
        ],
        default_host="http-me.fastly.dev",
        force_destroy=True)
    my_dyn_content_one = []
    def create_my_dyn_content_one(range_body):
        for range in [{"key": k, "value": v} for [k, v] in enumerate(range_body)]:
            my_dyn_content_one.append(fastly.ServiceDynamicSnippetContent(f"my_dyn_content_one-{range['key']}",
                service_id=myservice.id,
                snippet_id=range["value"].snippet_id,
                content="""if ( req.url ) {
     set req.http.my-snippet-test-header-one = "true";
    }"""))
    
    myservice.dynamicsnippets.apply(lambda resolved_outputs: create_my_dyn_content_one({d.name: d for d in resolved_outputs['dynamicsnippets'] if d.name == "My Dynamic Snippet One"}))
    my_dyn_content_two = []
    def create_my_dyn_content_two(range_body):
        for range in [{"key": k, "value": v} for [k, v] in enumerate(range_body)]:
            my_dyn_content_two.append(fastly.ServiceDynamicSnippetContent(f"my_dyn_content_two-{range['key']}",
                service_id=myservice.id,
                snippet_id=range["value"].snippet_id,
                content="""if ( req.url ) {
     set req.http.my-snippet-test-header-two = "true";
    }"""))
    
    myservice.dynamicsnippets.apply(lambda resolved_outputs: create_my_dyn_content_two({d.name: d for d in resolved_outputs['dynamicsnippets'] if d.name == "My Dynamic Snippet Two"}))
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        var myservice = new Fastly.ServiceVcl("myservice", new()
        {
            Name = "snippet_test",
            Domains = new[]
            {
                new Fastly.Inputs.ServiceVclDomainArgs
                {
                    Name = "snippet.fastlytestdomain.com",
                    Comment = "snippet test",
                },
            },
            Backends = new[]
            {
                new Fastly.Inputs.ServiceVclBackendArgs
                {
                    Address = "http-me.fastly.dev",
                    Name = "Glitch Test Site",
                    Port = 80,
                },
            },
            Dynamicsnippets = new[]
            {
                new Fastly.Inputs.ServiceVclDynamicsnippetArgs
                {
                    Name = "My Dynamic Snippet One",
                    Type = "recv",
                    Priority = 110,
                },
                new Fastly.Inputs.ServiceVclDynamicsnippetArgs
                {
                    Name = "My Dynamic Snippet Two",
                    Type = "recv",
                    Priority = 110,
                },
            },
            DefaultHost = "http-me.fastly.dev",
            ForceDestroy = true,
        });
    
        var myDynContentOne = new List<Fastly.ServiceDynamicSnippetContent>();
        foreach (var range in myservice.Dynamicsnippets.Apply(dynamicsnippets => ).Select(pair => new { pair.Key, pair.Value }))
        {
            myDynContentOne.Add(new Fastly.ServiceDynamicSnippetContent($"my_dyn_content_one-{range.Key}", new()
            {
                ServiceId = myservice.Id,
                SnippetId = range.Value.SnippetId,
                Content = @"if ( req.url ) {
     set req.http.my-snippet-test-header-one = ""true"";
    }",
            }));
        }
        var myDynContentTwo = new List<Fastly.ServiceDynamicSnippetContent>();
        foreach (var range in myservice.Dynamicsnippets.Apply(dynamicsnippets => ).Select(pair => new { pair.Key, pair.Value }))
        {
            myDynContentTwo.Add(new Fastly.ServiceDynamicSnippetContent($"my_dyn_content_two-{range.Key}", new()
            {
                ServiceId = myservice.Id,
                SnippetId = range.Value.SnippetId,
                Content = @"if ( req.url ) {
     set req.http.my-snippet-test-header-two = ""true"";
    }",
            }));
        }
    });
    
    Example coming soon!
    
    resources:
      myservice:
        type: fastly:ServiceVcl
        properties:
          name: snippet_test
          domains:
            - name: snippet.fastlytestdomain.com
              comment: snippet test
          backends:
            - address: http-me.fastly.dev
              name: Glitch Test Site
              port: 80
          dynamicsnippets:
            - name: My Dynamic Snippet One
              type: recv
              priority: 110
            - name: My Dynamic Snippet Two
              type: recv
              priority: 110
          defaultHost: http-me.fastly.dev
          forceDestroy: true
      myDynContentOne:
        type: fastly:ServiceDynamicSnippetContent
        name: my_dyn_content_one
        properties:
          serviceId: ${myservice.id}
          snippetId: ${range.value.snippetId}
          content: |-
            if ( req.url ) {
             set req.http.my-snippet-test-header-one = "true";
            }
        options: {}
      myDynContentTwo:
        type: fastly:ServiceDynamicSnippetContent
        name: my_dyn_content_two
        properties:
          serviceId: ${myservice.id}
          snippetId: ${range.value.snippetId}
          content: |-
            if ( req.url ) {
             set req.http.my-snippet-test-header-two = "true";
            }
        options: {}
    

    Terraform >= 0.12.0 && < 0.12.6)

    for_each attributes were not available in Terraform before 0.12.6, however, users can still use for expressions to achieve similar behaviour as seen in the example below.

    Warning: Terraform might not properly calculate implicit dependencies on computed attributes when using for expressions

    For scenarios such as adding a Dynamic Snippet to a service and at the same time, creating the Dynamic Snippets (fastly.ServiceDynamicSnippetContent) resource, Terraform will not calculate implicit dependencies correctly on for expressions. This will result in index lookup problems and the execution will fail.

    For those scenarios, it’s recommended to split the changes into two distinct steps:

    1. Add the dynamicsnippet block to the fastly.ServiceVcl and apply the changes
    2. Add the fastly.ServiceDynamicSnippetContent resource with the for expressions to the HCL and apply the changes

    Usage:

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    const myservice = new fastly.ServiceVcl("myservice", {
        name: "demofastly",
        domains: [{
            name: "demo.notexample.com",
            comment: "demo",
        }],
        dynamicsnippets: [{
            name: "My Dynamic Snippet",
            type: "recv",
            priority: 110,
        }],
    });
    const myDynContent = new fastly.ServiceDynamicSnippetContent("my_dyn_content", {
        serviceId: myservice.id,
        snippetId: myservice.dynamicsnippets.apply(dynamicsnippets => .reduce((__obj, s) => ({ ...__obj, [s.name]: s.snippetId }))["My Dynamic Snippet"]),
        content: `if ( req.url ) {
     set req.http.my-snippet-test-header = "true";
    }`,
    });
    
    import pulumi
    import pulumi_fastly as fastly
    
    myservice = fastly.ServiceVcl("myservice",
        name="demofastly",
        domains=[{
            "name": "demo.notexample.com",
            "comment": "demo",
        }],
        dynamicsnippets=[{
            "name": "My Dynamic Snippet",
            "type": "recv",
            "priority": 110,
        }])
    my_dyn_content = fastly.ServiceDynamicSnippetContent("my_dyn_content",
        service_id=myservice.id,
        snippet_id=myservice.dynamicsnippets.apply(lambda dynamicsnippets: {s.name: s.snippet_id for s in dynamicsnippets}["My Dynamic Snippet"]),
        content="""if ( req.url ) {
     set req.http.my-snippet-test-header = "true";
    }""")
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        var myservice = new Fastly.ServiceVcl("myservice", new()
        {
            Name = "demofastly",
            Domains = new[]
            {
                new Fastly.Inputs.ServiceVclDomainArgs
                {
                    Name = "demo.notexample.com",
                    Comment = "demo",
                },
            },
            Dynamicsnippets = new[]
            {
                new Fastly.Inputs.ServiceVclDynamicsnippetArgs
                {
                    Name = "My Dynamic Snippet",
                    Type = "recv",
                    Priority = 110,
                },
            },
        });
    
        var myDynContent = new Fastly.ServiceDynamicSnippetContent("my_dyn_content", new()
        {
            ServiceId = myservice.Id,
            SnippetId = myservice.Dynamicsnippets.Apply(dynamicsnippets => .ToDictionary(item => {
                var s = item.Value;
                return s.Name;
            }, item => {
                var s = item.Value;
                return s.SnippetId;
            }).My_Dynamic_Snippet),
            Content = @"if ( req.url ) {
     set req.http.my-snippet-test-header = ""true"";
    }",
        });
    
    });
    
    Example coming soon!
    
    Example coming soon!
    

    Reapplying original snippets with manage_snippets if the state of the snippets drifts

    By default the user is opted out from reapplying the original changes if the snippets are managed externally. The following example demonstrates how the manage_snippets field can be used to reapply the changes defined in the HCL if the state of the snippets drifts. When the value is explicitly set to ’true’, Terraform will keep the original changes and discard any other changes made under this resource outside of Terraform.

    Warning: You will lose externally managed snippets if manage_snippets=true.

    Note: The ignore_changes built-in meta-argument takes precedence over manage_snippets regardless of its value.

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    //...
    const myDynContent: fastly.ServiceDynamicSnippetContent[] = [];
    for (const range of Object.entries(.filter(d => d.name == "My Dynamic Snippet").reduce((__obj, d) => ({ ...__obj, [d.name]: d }))).map(([k, v]) => ({key: k, value: v}))) {
        myDynContent.push(new fastly.ServiceDynamicSnippetContent(`my_dyn_content-${range.key}`, {
            serviceId: myservice.id,
            snippetId: range.value.snippetId,
            manageSnippets: true,
            content: `if ( req.url ) {
     set req.http.my-snippet-test-header = "true";
    }`,
        }));
    }
    
    import pulumi
    import pulumi_fastly as fastly
    
    #...
    my_dyn_content = []
    for range in [{"key": k, "value": v} for [k, v] in enumerate({d.name: d for d in myservice.dynamicsnippet if d.name == My Dynamic Snippet})]:
        my_dyn_content.append(fastly.ServiceDynamicSnippetContent(f"my_dyn_content-{range['key']}",
            service_id=myservice["id"],
            snippet_id=range["value"]["snippetId"],
            manage_snippets=True,
            content="""if ( req.url ) {
     set req.http.my-snippet-test-header = "true";
    }"""))
    
    Example coming soon!
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        //...
        var myDynContent = new List<Fastly.ServiceDynamicSnippetContent>();
        foreach (var range in .ToDictionary(item => {
            var d = item.Value;
            return d.Name;
        }, item => {
            var d = item.Value;
            return d;
        }).Select(pair => new { pair.Key, pair.Value }))
        {
            myDynContent.Add(new Fastly.ServiceDynamicSnippetContent($"my_dyn_content-{range.Key}", new()
            {
                ServiceId = myservice.Id,
                SnippetId = range.Value.SnippetId,
                ManageSnippets = true,
                Content = @"if ( req.url ) {
     set req.http.my-snippet-test-header = ""true"";
    }",
            }));
        }
    });
    
    Example coming soon!
    
    resources:
      #...
      myDynContent:
        type: fastly:ServiceDynamicSnippetContent
        name: my_dyn_content
        properties:
          serviceId: ${myservice.id}
          snippetId: ${range.value.snippetId}
          manageSnippets: true
          content: |-
            if ( req.url ) {
             set req.http.my-snippet-test-header = "true";
            }
        options: {}
    

    Create ServiceDynamicSnippetContent Resource

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

    Constructor syntax

    new ServiceDynamicSnippetContent(name: string, args: ServiceDynamicSnippetContentArgs, opts?: CustomResourceOptions);
    @overload
    def ServiceDynamicSnippetContent(resource_name: str,
                                     args: ServiceDynamicSnippetContentArgs,
                                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServiceDynamicSnippetContent(resource_name: str,
                                     opts: Optional[ResourceOptions] = None,
                                     content: Optional[str] = None,
                                     service_id: Optional[str] = None,
                                     snippet_id: Optional[str] = None,
                                     manage_snippets: Optional[bool] = None)
    func NewServiceDynamicSnippetContent(ctx *Context, name string, args ServiceDynamicSnippetContentArgs, opts ...ResourceOption) (*ServiceDynamicSnippetContent, error)
    public ServiceDynamicSnippetContent(string name, ServiceDynamicSnippetContentArgs args, CustomResourceOptions? opts = null)
    public ServiceDynamicSnippetContent(String name, ServiceDynamicSnippetContentArgs args)
    public ServiceDynamicSnippetContent(String name, ServiceDynamicSnippetContentArgs args, CustomResourceOptions options)
    
    type: fastly:ServiceDynamicSnippetContent
    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 ServiceDynamicSnippetContentArgs
    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 ServiceDynamicSnippetContentArgs
    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 ServiceDynamicSnippetContentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceDynamicSnippetContentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceDynamicSnippetContentArgs
    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 serviceDynamicSnippetContentResource = new Fastly.ServiceDynamicSnippetContent("serviceDynamicSnippetContentResource", new()
    {
        Content = "string",
        ServiceId = "string",
        SnippetId = "string",
        ManageSnippets = false,
    });
    
    example, err := fastly.NewServiceDynamicSnippetContent(ctx, "serviceDynamicSnippetContentResource", &fastly.ServiceDynamicSnippetContentArgs{
    	Content:        pulumi.String("string"),
    	ServiceId:      pulumi.String("string"),
    	SnippetId:      pulumi.String("string"),
    	ManageSnippets: pulumi.Bool(false),
    })
    
    var serviceDynamicSnippetContentResource = new ServiceDynamicSnippetContent("serviceDynamicSnippetContentResource", ServiceDynamicSnippetContentArgs.builder()
        .content("string")
        .serviceId("string")
        .snippetId("string")
        .manageSnippets(false)
        .build());
    
    service_dynamic_snippet_content_resource = fastly.ServiceDynamicSnippetContent("serviceDynamicSnippetContentResource",
        content="string",
        service_id="string",
        snippet_id="string",
        manage_snippets=False)
    
    const serviceDynamicSnippetContentResource = new fastly.ServiceDynamicSnippetContent("serviceDynamicSnippetContentResource", {
        content: "string",
        serviceId: "string",
        snippetId: "string",
        manageSnippets: false,
    });
    
    type: fastly:ServiceDynamicSnippetContent
    properties:
        content: string
        manageSnippets: false
        serviceId: string
        snippetId: string
    

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

    Content string
    The VCL code that specifies exactly what the snippet does
    ServiceId string
    The ID of the service that the dynamic snippet belongs to
    SnippetId string
    The ID of the dynamic snippet that the content belong to
    ManageSnippets bool
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    Content string
    The VCL code that specifies exactly what the snippet does
    ServiceId string
    The ID of the service that the dynamic snippet belongs to
    SnippetId string
    The ID of the dynamic snippet that the content belong to
    ManageSnippets bool
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    content String
    The VCL code that specifies exactly what the snippet does
    serviceId String
    The ID of the service that the dynamic snippet belongs to
    snippetId String
    The ID of the dynamic snippet that the content belong to
    manageSnippets Boolean
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    content string
    The VCL code that specifies exactly what the snippet does
    serviceId string
    The ID of the service that the dynamic snippet belongs to
    snippetId string
    The ID of the dynamic snippet that the content belong to
    manageSnippets boolean
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    content str
    The VCL code that specifies exactly what the snippet does
    service_id str
    The ID of the service that the dynamic snippet belongs to
    snippet_id str
    The ID of the dynamic snippet that the content belong to
    manage_snippets bool
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    content String
    The VCL code that specifies exactly what the snippet does
    serviceId String
    The ID of the service that the dynamic snippet belongs to
    snippetId String
    The ID of the dynamic snippet that the content belong to
    manageSnippets Boolean
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally

    Outputs

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

    Get an existing ServiceDynamicSnippetContent 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?: ServiceDynamicSnippetContentState, opts?: CustomResourceOptions): ServiceDynamicSnippetContent
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            content: Optional[str] = None,
            manage_snippets: Optional[bool] = None,
            service_id: Optional[str] = None,
            snippet_id: Optional[str] = None) -> ServiceDynamicSnippetContent
    func GetServiceDynamicSnippetContent(ctx *Context, name string, id IDInput, state *ServiceDynamicSnippetContentState, opts ...ResourceOption) (*ServiceDynamicSnippetContent, error)
    public static ServiceDynamicSnippetContent Get(string name, Input<string> id, ServiceDynamicSnippetContentState? state, CustomResourceOptions? opts = null)
    public static ServiceDynamicSnippetContent get(String name, Output<String> id, ServiceDynamicSnippetContentState state, CustomResourceOptions options)
    resources:  _:    type: fastly:ServiceDynamicSnippetContent    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:
    Content string
    The VCL code that specifies exactly what the snippet does
    ManageSnippets bool
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    ServiceId string
    The ID of the service that the dynamic snippet belongs to
    SnippetId string
    The ID of the dynamic snippet that the content belong to
    Content string
    The VCL code that specifies exactly what the snippet does
    ManageSnippets bool
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    ServiceId string
    The ID of the service that the dynamic snippet belongs to
    SnippetId string
    The ID of the dynamic snippet that the content belong to
    content String
    The VCL code that specifies exactly what the snippet does
    manageSnippets Boolean
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    serviceId String
    The ID of the service that the dynamic snippet belongs to
    snippetId String
    The ID of the dynamic snippet that the content belong to
    content string
    The VCL code that specifies exactly what the snippet does
    manageSnippets boolean
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    serviceId string
    The ID of the service that the dynamic snippet belongs to
    snippetId string
    The ID of the dynamic snippet that the content belong to
    content str
    The VCL code that specifies exactly what the snippet does
    manage_snippets bool
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    service_id str
    The ID of the service that the dynamic snippet belongs to
    snippet_id str
    The ID of the dynamic snippet that the content belong to
    content String
    The VCL code that specifies exactly what the snippet does
    manageSnippets Boolean
    Whether to reapply changes if the state of the snippets drifts, i.e. if snippets are managed externally
    serviceId String
    The ID of the service that the dynamic snippet belongs to
    snippetId String
    The ID of the dynamic snippet that the content belong to

    Import

    This is an example of the import command being applied to the resource named fastly_service_dynamic_snippet_content.content The resource ID is a combined value of the service_id and snippet_id separated by a forward slash.

    $ pulumi import fastly:index/serviceDynamicSnippetContent:ServiceDynamicSnippetContent content xxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxx
    

    If Terraform is already managing remote content against a resource being imported then the user will be asked to remove it from the existing Terraform state. The following is an example of the Terraform state command to remove the resource named fastly_service_dynamic_snippet_content.content from the Terraform state file.

    $ terraform state rm fastly_service_dynamic_snippet_content.content
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Fastly pulumi/pulumi-fastly
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the fastly Terraform Provider.
    fastly logo
    Viewing docs for Fastly v11.4.1
    published on Friday, Feb 27, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.