1. Packages
  2. Fastly
  3. API Docs
  4. Kvstore
Fastly v8.6.0 published on Monday, Apr 22, 2024 by Pulumi

fastly.Kvstore

Explore with Pulumi AI

fastly logo
Fastly v8.6.0 published on Monday, Apr 22, 2024 by Pulumi

    Example Usage

    Basic usage:

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    // IMPORTANT: Deleting a KV Store requires first deleting its resource_link.
    // This requires a two-step `pulumi up` as we can't guarantee deletion order.
    // e.g. resource_link deletion within fastly_service_compute might not finish first.
    const exampleKvstore = new fastly.Kvstore("example", {name: "my_kv_store"});
    const example = fastly.getPackageHash({
        filename: "package.tar.gz",
    });
    const exampleServiceCompute = new fastly.ServiceCompute("example", {
        name: "my_compute_service",
        domains: [{
            name: "demo.example.com",
        }],
        "package": {
            filename: "package.tar.gz",
            sourceCodeHash: example.then(example => example.hash),
        },
        resourceLinks: [{
            name: "my_resource_link",
            resourceId: exampleKvstore.id,
        }],
        forceDestroy: true,
    });
    
    import pulumi
    import pulumi_fastly as fastly
    
    # IMPORTANT: Deleting a KV Store requires first deleting its resource_link.
    # This requires a two-step `pulumi up` as we can't guarantee deletion order.
    # e.g. resource_link deletion within fastly_service_compute might not finish first.
    example_kvstore = fastly.Kvstore("example", name="my_kv_store")
    example = fastly.get_package_hash(filename="package.tar.gz")
    example_service_compute = fastly.ServiceCompute("example",
        name="my_compute_service",
        domains=[fastly.ServiceComputeDomainArgs(
            name="demo.example.com",
        )],
        package=fastly.ServiceComputePackageArgs(
            filename="package.tar.gz",
            source_code_hash=example.hash,
        ),
        resource_links=[fastly.ServiceComputeResourceLinkArgs(
            name="my_resource_link",
            resource_id=example_kvstore.id,
        )],
        force_destroy=True)
    
    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 {
    		// IMPORTANT: Deleting a KV Store requires first deleting its resource_link.
    		// This requires a two-step `pulumi up` as we can't guarantee deletion order.
    		// e.g. resource_link deletion within fastly_service_compute might not finish first.
    		exampleKvstore, err := fastly.NewKvstore(ctx, "example", &fastly.KvstoreArgs{
    			Name: pulumi.String("my_kv_store"),
    		})
    		if err != nil {
    			return err
    		}
    		example, err := fastly.GetPackageHash(ctx, &fastly.GetPackageHashArgs{
    			Filename: pulumi.StringRef("package.tar.gz"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = fastly.NewServiceCompute(ctx, "example", &fastly.ServiceComputeArgs{
    			Name: pulumi.String("my_compute_service"),
    			Domains: fastly.ServiceComputeDomainArray{
    				&fastly.ServiceComputeDomainArgs{
    					Name: pulumi.String("demo.example.com"),
    				},
    			},
    			Package: &fastly.ServiceComputePackageArgs{
    				Filename:       pulumi.String("package.tar.gz"),
    				SourceCodeHash: pulumi.String(example.Hash),
    			},
    			ResourceLinks: fastly.ServiceComputeResourceLinkArray{
    				&fastly.ServiceComputeResourceLinkArgs{
    					Name:       pulumi.String("my_resource_link"),
    					ResourceId: exampleKvstore.ID(),
    				},
    			},
    			ForceDestroy: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        // IMPORTANT: Deleting a KV Store requires first deleting its resource_link.
        // This requires a two-step `pulumi up` as we can't guarantee deletion order.
        // e.g. resource_link deletion within fastly_service_compute might not finish first.
        var exampleKvstore = new Fastly.Kvstore("example", new()
        {
            Name = "my_kv_store",
        });
    
        var example = Fastly.GetPackageHash.Invoke(new()
        {
            Filename = "package.tar.gz",
        });
    
        var exampleServiceCompute = new Fastly.ServiceCompute("example", new()
        {
            Name = "my_compute_service",
            Domains = new[]
            {
                new Fastly.Inputs.ServiceComputeDomainArgs
                {
                    Name = "demo.example.com",
                },
            },
            Package = new Fastly.Inputs.ServiceComputePackageArgs
            {
                Filename = "package.tar.gz",
                SourceCodeHash = example.Apply(getPackageHashResult => getPackageHashResult.Hash),
            },
            ResourceLinks = new[]
            {
                new Fastly.Inputs.ServiceComputeResourceLinkArgs
                {
                    Name = "my_resource_link",
                    ResourceId = exampleKvstore.Id,
                },
            },
            ForceDestroy = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.fastly.Kvstore;
    import com.pulumi.fastly.KvstoreArgs;
    import com.pulumi.fastly.FastlyFunctions;
    import com.pulumi.fastly.inputs.GetPackageHashArgs;
    import com.pulumi.fastly.ServiceCompute;
    import com.pulumi.fastly.ServiceComputeArgs;
    import com.pulumi.fastly.inputs.ServiceComputeDomainArgs;
    import com.pulumi.fastly.inputs.ServiceComputePackageArgs;
    import com.pulumi.fastly.inputs.ServiceComputeResourceLinkArgs;
    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) {
            // IMPORTANT: Deleting a KV Store requires first deleting its resource_link.
            // This requires a two-step `pulumi up` as we can't guarantee deletion order.
            // e.g. resource_link deletion within fastly_service_compute might not finish first.
            var exampleKvstore = new Kvstore("exampleKvstore", KvstoreArgs.builder()        
                .name("my_kv_store")
                .build());
    
            final var example = FastlyFunctions.getPackageHash(GetPackageHashArgs.builder()
                .filename("package.tar.gz")
                .build());
    
            var exampleServiceCompute = new ServiceCompute("exampleServiceCompute", ServiceComputeArgs.builder()        
                .name("my_compute_service")
                .domains(ServiceComputeDomainArgs.builder()
                    .name("demo.example.com")
                    .build())
                .package_(ServiceComputePackageArgs.builder()
                    .filename("package.tar.gz")
                    .sourceCodeHash(example.applyValue(getPackageHashResult -> getPackageHashResult.hash()))
                    .build())
                .resourceLinks(ServiceComputeResourceLinkArgs.builder()
                    .name("my_resource_link")
                    .resourceId(exampleKvstore.id())
                    .build())
                .forceDestroy(true)
                .build());
    
        }
    }
    
    resources:
      # IMPORTANT: Deleting a KV Store requires first deleting its resource_link.
      # This requires a two-step `pulumi up` as we can't guarantee deletion order.
      # e.g. resource_link deletion within fastly_service_compute might not finish first.
      exampleKvstore:
        type: fastly:Kvstore
        name: example
        properties:
          name: my_kv_store
      exampleServiceCompute:
        type: fastly:ServiceCompute
        name: example
        properties:
          name: my_compute_service
          domains:
            - name: demo.example.com
          package:
            filename: package.tar.gz
            sourceCodeHash: ${example.hash}
          resourceLinks:
            - name: my_resource_link
              resourceId: ${exampleKvstore.id}
          forceDestroy: true
    variables:
      example:
        fn::invoke:
          Function: fastly:getPackageHash
          Arguments:
            filename: package.tar.gz
    

    Create Kvstore Resource

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

    Constructor syntax

    new Kvstore(name: string, args?: KvstoreArgs, opts?: CustomResourceOptions);
    @overload
    def Kvstore(resource_name: str,
                args: Optional[KvstoreArgs] = None,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Kvstore(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                force_destroy: Optional[bool] = None,
                location: Optional[str] = None,
                name: Optional[str] = None)
    func NewKvstore(ctx *Context, name string, args *KvstoreArgs, opts ...ResourceOption) (*Kvstore, error)
    public Kvstore(string name, KvstoreArgs? args = null, CustomResourceOptions? opts = null)
    public Kvstore(String name, KvstoreArgs args)
    public Kvstore(String name, KvstoreArgs args, CustomResourceOptions options)
    
    type: fastly:Kvstore
    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 KvstoreArgs
    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 KvstoreArgs
    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 KvstoreArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args KvstoreArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args KvstoreArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var kvstoreResource = new Fastly.Kvstore("kvstoreResource", new()
    {
        ForceDestroy = false,
        Location = "string",
        Name = "string",
    });
    
    example, err := fastly.NewKvstore(ctx, "kvstoreResource", &fastly.KvstoreArgs{
    	ForceDestroy: pulumi.Bool(false),
    	Location:     pulumi.String("string"),
    	Name:         pulumi.String("string"),
    })
    
    var kvstoreResource = new Kvstore("kvstoreResource", KvstoreArgs.builder()        
        .forceDestroy(false)
        .location("string")
        .name("string")
        .build());
    
    kvstore_resource = fastly.Kvstore("kvstoreResource",
        force_destroy=False,
        location="string",
        name="string")
    
    const kvstoreResource = new fastly.Kvstore("kvstoreResource", {
        forceDestroy: false,
        location: "string",
        name: "string",
    });
    
    type: fastly:Kvstore
    properties:
        forceDestroy: false
        location: string
        name: string
    

    Kvstore Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Kvstore resource accepts the following input properties:

    ForceDestroy bool
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    Location string
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    Name string
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.
    ForceDestroy bool
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    Location string
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    Name string
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.
    forceDestroy Boolean
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    location String
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    name String
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.
    forceDestroy boolean
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    location string
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    name string
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.
    force_destroy bool
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    location str
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    name str
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.
    forceDestroy Boolean
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    location String
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    name String
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.

    Outputs

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

    Get an existing Kvstore 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?: KvstoreState, opts?: CustomResourceOptions): Kvstore
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            force_destroy: Optional[bool] = None,
            location: Optional[str] = None,
            name: Optional[str] = None) -> Kvstore
    func GetKvstore(ctx *Context, name string, id IDInput, state *KvstoreState, opts ...ResourceOption) (*Kvstore, error)
    public static Kvstore Get(string name, Input<string> id, KvstoreState? state, CustomResourceOptions? opts = null)
    public static Kvstore get(String name, Output<String> id, KvstoreState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    ForceDestroy bool
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    Location string
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    Name string
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.
    ForceDestroy bool
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    Location string
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    Name string
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.
    forceDestroy Boolean
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    location String
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    name String
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.
    forceDestroy boolean
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    location string
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    name string
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.
    force_destroy bool
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    location str
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    name str
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.
    forceDestroy Boolean
    Allow the KV Store to be deleted, even if it contains entries. Defaults to false.
    location String
    The regional location of the KV Store. Valid values are US, EU, ASIA, and AUS.
    name String
    A unique name to identify the KV Store. It is important to note that changing this attribute will delete and recreate the KV Store, and discard the current entries. You MUST first delete the associated resource_link block from your service before modifying this field.

    Import

    Fastly KV Stores can be imported using their Store ID, e.g.

    $ pulumi import fastly:index/kvstore:Kvstore example xxxxxxxxxxxxxxxxxxxx
    

    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
    Fastly v8.6.0 published on Monday, Apr 22, 2024 by Pulumi