1. Packages
  2. Etcd Provider
  3. API Docs
  4. SynchronizedDirectory
etcd 0.10.0 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine

etcd.SynchronizedDirectory

Explore with Pulumi AI

etcd logo
etcd 0.10.0 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine

    Synchronizes the content of an key prefix and directory. Note that etcd is has a default max object size of 1.5MiB and is most suitable for keys that are bounded to a small size like configurations. Use another solution for larger files. Also, currently, only file systems following the unix convention are supported.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as etcd from "@pulumi/etcd";
    
    //Upload some prometheus configs
    const prometheusConfs = new etcd.SynchronizedDirectory("prometheusConfs", {
        directory: `${path.module}/prometheus-confs`,
        keyPrefix: "/prometheus-confs/",
        source: "directory",
        recurrence: "once",
    }, {
        provider: etcdnew,
    });
    //sync key range in etcdnew with the one in etcdold
    const source = new etcd.SynchronizedDirectory("source", {
        directory: "/tmp/prefix-to-transfer",
        keyPrefix: "/prefix-to-transfer/",
        source: "key-prefix",
        recurrence: "once",
    }, {
        provider: etcdold,
    });
    const destination = new etcd.SynchronizedDirectory("destination", {
        directory: "/tmp/prefix-to-transfer",
        keyPrefix: "/prefix-to-transfer/",
        source: "directory",
        recurrence: "once",
    }, {
        provider: etcdnew,
        dependsOn: [source],
    });
    
    import pulumi
    import pulumi_etcd as etcd
    
    #Upload some prometheus configs
    prometheus_confs = etcd.SynchronizedDirectory("prometheusConfs",
        directory=f"{path['module']}/prometheus-confs",
        key_prefix="/prometheus-confs/",
        source="directory",
        recurrence="once",
        opts = pulumi.ResourceOptions(provider=etcdnew))
    #sync key range in etcdnew with the one in etcdold
    source = etcd.SynchronizedDirectory("source",
        directory="/tmp/prefix-to-transfer",
        key_prefix="/prefix-to-transfer/",
        source="key-prefix",
        recurrence="once",
        opts = pulumi.ResourceOptions(provider=etcdold))
    destination = etcd.SynchronizedDirectory("destination",
        directory="/tmp/prefix-to-transfer",
        key_prefix="/prefix-to-transfer/",
        source="directory",
        recurrence="once",
        opts = pulumi.ResourceOptions(provider=etcdnew,
            depends_on=[source]))
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/etcd/etcd"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Upload some prometheus configs
    		_, err := etcd.NewSynchronizedDirectory(ctx, "prometheusConfs", &etcd.SynchronizedDirectoryArgs{
    			Directory:  pulumi.Sprintf("%v/prometheus-confs", path.Module),
    			KeyPrefix:  pulumi.String("/prometheus-confs/"),
    			Source:     pulumi.String("directory"),
    			Recurrence: pulumi.String("once"),
    		}, pulumi.Provider(etcdnew))
    		if err != nil {
    			return err
    		}
    		// sync key range in etcdnew with the one in etcdold
    		source, err := etcd.NewSynchronizedDirectory(ctx, "source", &etcd.SynchronizedDirectoryArgs{
    			Directory:  pulumi.String("/tmp/prefix-to-transfer"),
    			KeyPrefix:  pulumi.String("/prefix-to-transfer/"),
    			Source:     pulumi.String("key-prefix"),
    			Recurrence: pulumi.String("once"),
    		}, pulumi.Provider(etcdold))
    		if err != nil {
    			return err
    		}
    		_, err = etcd.NewSynchronizedDirectory(ctx, "destination", &etcd.SynchronizedDirectoryArgs{
    			Directory:  pulumi.String("/tmp/prefix-to-transfer"),
    			KeyPrefix:  pulumi.String("/prefix-to-transfer/"),
    			Source:     pulumi.String("directory"),
    			Recurrence: pulumi.String("once"),
    		}, pulumi.Provider(etcdnew), pulumi.DependsOn([]pulumi.Resource{
    			source,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Etcd = Pulumi.Etcd;
    
    return await Deployment.RunAsync(() => 
    {
        //Upload some prometheus configs
        var prometheusConfs = new Etcd.SynchronizedDirectory("prometheusConfs", new()
        {
            Directory = $"{path.Module}/prometheus-confs",
            KeyPrefix = "/prometheus-confs/",
            Source = "directory",
            Recurrence = "once",
        }, new CustomResourceOptions
        {
            Provider = etcdnew,
        });
    
        //sync key range in etcdnew with the one in etcdold
        var source = new Etcd.SynchronizedDirectory("source", new()
        {
            Directory = "/tmp/prefix-to-transfer",
            KeyPrefix = "/prefix-to-transfer/",
            Source = "key-prefix",
            Recurrence = "once",
        }, new CustomResourceOptions
        {
            Provider = etcdold,
        });
    
        var destination = new Etcd.SynchronizedDirectory("destination", new()
        {
            Directory = "/tmp/prefix-to-transfer",
            KeyPrefix = "/prefix-to-transfer/",
            Source = "directory",
            Recurrence = "once",
        }, new CustomResourceOptions
        {
            Provider = etcdnew,
            DependsOn =
            {
                source,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.etcd.SynchronizedDirectory;
    import com.pulumi.etcd.SynchronizedDirectoryArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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) {
            //Upload some prometheus configs
            var prometheusConfs = new SynchronizedDirectory("prometheusConfs", SynchronizedDirectoryArgs.builder()
                .directory(String.format("%s/prometheus-confs", path.module()))
                .keyPrefix("/prometheus-confs/")
                .source("directory")
                .recurrence("once")
                .build(), CustomResourceOptions.builder()
                    .provider(etcdnew)
                    .build());
    
            //sync key range in etcdnew with the one in etcdold
            var source = new SynchronizedDirectory("source", SynchronizedDirectoryArgs.builder()
                .directory("/tmp/prefix-to-transfer")
                .keyPrefix("/prefix-to-transfer/")
                .source("key-prefix")
                .recurrence("once")
                .build(), CustomResourceOptions.builder()
                    .provider(etcdold)
                    .build());
    
            var destination = new SynchronizedDirectory("destination", SynchronizedDirectoryArgs.builder()
                .directory("/tmp/prefix-to-transfer")
                .keyPrefix("/prefix-to-transfer/")
                .source("directory")
                .recurrence("once")
                .build(), CustomResourceOptions.builder()
                    .provider(etcdnew)
                    .dependsOn(source)
                    .build());
    
        }
    }
    
    resources:
      # Upload some prometheus configs
      prometheusConfs:
        type: etcd:SynchronizedDirectory
        properties:
          directory: ${path.module}/prometheus-confs
          keyPrefix: /prometheus-confs/
          source: directory
          recurrence: once
        options:
          provider: ${etcdnew}
      # sync key range in etcdnew with the one in etcdold
      source:
        type: etcd:SynchronizedDirectory
        properties:
          directory: /tmp/prefix-to-transfer
          keyPrefix: /prefix-to-transfer/
          source: key-prefix
          recurrence: once
        options:
          provider: ${etcdold}
      destination:
        type: etcd:SynchronizedDirectory
        properties:
          directory: /tmp/prefix-to-transfer
          keyPrefix: /prefix-to-transfer/
          source: directory
          recurrence: once
        options:
          provider: ${etcdnew}
          dependsOn:
            - ${source}
    

    Create SynchronizedDirectory Resource

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

    Constructor syntax

    new SynchronizedDirectory(name: string, args: SynchronizedDirectoryArgs, opts?: CustomResourceOptions);
    @overload
    def SynchronizedDirectory(resource_name: str,
                              args: SynchronizedDirectoryArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def SynchronizedDirectory(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              directory: Optional[str] = None,
                              key_prefix: Optional[str] = None,
                              source: Optional[str] = None,
                              directory_permission: Optional[str] = None,
                              files_permission: Optional[str] = None,
                              recurrence: Optional[str] = None,
                              synchronized_directory_id: Optional[str] = None)
    func NewSynchronizedDirectory(ctx *Context, name string, args SynchronizedDirectoryArgs, opts ...ResourceOption) (*SynchronizedDirectory, error)
    public SynchronizedDirectory(string name, SynchronizedDirectoryArgs args, CustomResourceOptions? opts = null)
    public SynchronizedDirectory(String name, SynchronizedDirectoryArgs args)
    public SynchronizedDirectory(String name, SynchronizedDirectoryArgs args, CustomResourceOptions options)
    
    type: etcd:SynchronizedDirectory
    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 SynchronizedDirectoryArgs
    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 SynchronizedDirectoryArgs
    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 SynchronizedDirectoryArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SynchronizedDirectoryArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SynchronizedDirectoryArgs
    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 synchronizedDirectoryResource = new Etcd.SynchronizedDirectory("synchronizedDirectoryResource", new()
    {
        Directory = "string",
        KeyPrefix = "string",
        Source = "string",
        DirectoryPermission = "string",
        FilesPermission = "string",
        Recurrence = "string",
        SynchronizedDirectoryId = "string",
    });
    
    example, err := etcd.NewSynchronizedDirectory(ctx, "synchronizedDirectoryResource", &etcd.SynchronizedDirectoryArgs{
    	Directory:               pulumi.String("string"),
    	KeyPrefix:               pulumi.String("string"),
    	Source:                  pulumi.String("string"),
    	DirectoryPermission:     pulumi.String("string"),
    	FilesPermission:         pulumi.String("string"),
    	Recurrence:              pulumi.String("string"),
    	SynchronizedDirectoryId: pulumi.String("string"),
    })
    
    var synchronizedDirectoryResource = new SynchronizedDirectory("synchronizedDirectoryResource", SynchronizedDirectoryArgs.builder()
        .directory("string")
        .keyPrefix("string")
        .source("string")
        .directoryPermission("string")
        .filesPermission("string")
        .recurrence("string")
        .synchronizedDirectoryId("string")
        .build());
    
    synchronized_directory_resource = etcd.SynchronizedDirectory("synchronizedDirectoryResource",
        directory="string",
        key_prefix="string",
        source="string",
        directory_permission="string",
        files_permission="string",
        recurrence="string",
        synchronized_directory_id="string")
    
    const synchronizedDirectoryResource = new etcd.SynchronizedDirectory("synchronizedDirectoryResource", {
        directory: "string",
        keyPrefix: "string",
        source: "string",
        directoryPermission: "string",
        filesPermission: "string",
        recurrence: "string",
        synchronizedDirectoryId: "string",
    });
    
    type: etcd:SynchronizedDirectory
    properties:
        directory: string
        directoryPermission: string
        filesPermission: string
        keyPrefix: string
        recurrence: string
        source: string
        synchronizedDirectoryId: string
    

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

    Directory string
    Directory to synchronize with the key prefix.
    KeyPrefix string
    Key prefix to synchronize with the directory.
    Source string
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    DirectoryPermission string
    Permission of generated directories if the directory is the destination and missing.
    FilesPermission string
    Permission of generated files in the case where the directory is the destination.
    Recurrence string
    SynchronizedDirectoryId string
    The ID of this resource.
    Directory string
    Directory to synchronize with the key prefix.
    KeyPrefix string
    Key prefix to synchronize with the directory.
    Source string
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    DirectoryPermission string
    Permission of generated directories if the directory is the destination and missing.
    FilesPermission string
    Permission of generated files in the case where the directory is the destination.
    Recurrence string
    SynchronizedDirectoryId string
    The ID of this resource.
    directory String
    Directory to synchronize with the key prefix.
    keyPrefix String
    Key prefix to synchronize with the directory.
    source String
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    directoryPermission String
    Permission of generated directories if the directory is the destination and missing.
    filesPermission String
    Permission of generated files in the case where the directory is the destination.
    recurrence String
    synchronizedDirectoryId String
    The ID of this resource.
    directory string
    Directory to synchronize with the key prefix.
    keyPrefix string
    Key prefix to synchronize with the directory.
    source string
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    directoryPermission string
    Permission of generated directories if the directory is the destination and missing.
    filesPermission string
    Permission of generated files in the case where the directory is the destination.
    recurrence string
    synchronizedDirectoryId string
    The ID of this resource.
    directory str
    Directory to synchronize with the key prefix.
    key_prefix str
    Key prefix to synchronize with the directory.
    source str
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    directory_permission str
    Permission of generated directories if the directory is the destination and missing.
    files_permission str
    Permission of generated files in the case where the directory is the destination.
    recurrence str
    synchronized_directory_id str
    The ID of this resource.
    directory String
    Directory to synchronize with the key prefix.
    keyPrefix String
    Key prefix to synchronize with the directory.
    source String
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    directoryPermission String
    Permission of generated directories if the directory is the destination and missing.
    filesPermission String
    Permission of generated files in the case where the directory is the destination.
    recurrence String
    synchronizedDirectoryId String
    The ID of this resource.

    Outputs

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

    Get an existing SynchronizedDirectory 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?: SynchronizedDirectoryState, opts?: CustomResourceOptions): SynchronizedDirectory
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            directory: Optional[str] = None,
            directory_permission: Optional[str] = None,
            files_permission: Optional[str] = None,
            key_prefix: Optional[str] = None,
            recurrence: Optional[str] = None,
            source: Optional[str] = None,
            synchronized_directory_id: Optional[str] = None) -> SynchronizedDirectory
    func GetSynchronizedDirectory(ctx *Context, name string, id IDInput, state *SynchronizedDirectoryState, opts ...ResourceOption) (*SynchronizedDirectory, error)
    public static SynchronizedDirectory Get(string name, Input<string> id, SynchronizedDirectoryState? state, CustomResourceOptions? opts = null)
    public static SynchronizedDirectory get(String name, Output<String> id, SynchronizedDirectoryState state, CustomResourceOptions options)
    resources:  _:    type: etcd:SynchronizedDirectory    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:
    Directory string
    Directory to synchronize with the key prefix.
    DirectoryPermission string
    Permission of generated directories if the directory is the destination and missing.
    FilesPermission string
    Permission of generated files in the case where the directory is the destination.
    KeyPrefix string
    Key prefix to synchronize with the directory.
    Recurrence string
    Source string
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    SynchronizedDirectoryId string
    The ID of this resource.
    Directory string
    Directory to synchronize with the key prefix.
    DirectoryPermission string
    Permission of generated directories if the directory is the destination and missing.
    FilesPermission string
    Permission of generated files in the case where the directory is the destination.
    KeyPrefix string
    Key prefix to synchronize with the directory.
    Recurrence string
    Source string
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    SynchronizedDirectoryId string
    The ID of this resource.
    directory String
    Directory to synchronize with the key prefix.
    directoryPermission String
    Permission of generated directories if the directory is the destination and missing.
    filesPermission String
    Permission of generated files in the case where the directory is the destination.
    keyPrefix String
    Key prefix to synchronize with the directory.
    recurrence String
    source String
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    synchronizedDirectoryId String
    The ID of this resource.
    directory string
    Directory to synchronize with the key prefix.
    directoryPermission string
    Permission of generated directories if the directory is the destination and missing.
    filesPermission string
    Permission of generated files in the case where the directory is the destination.
    keyPrefix string
    Key prefix to synchronize with the directory.
    recurrence string
    source string
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    synchronizedDirectoryId string
    The ID of this resource.
    directory str
    Directory to synchronize with the key prefix.
    directory_permission str
    Permission of generated directories if the directory is the destination and missing.
    files_permission str
    Permission of generated files in the case where the directory is the destination.
    key_prefix str
    Key prefix to synchronize with the directory.
    recurrence str
    source str
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    synchronized_directory_id str
    The ID of this resource.
    directory String
    Directory to synchronize with the key prefix.
    directoryPermission String
    Permission of generated directories if the directory is the destination and missing.
    filesPermission String
    Permission of generated files in the case where the directory is the destination.
    keyPrefix String
    Key prefix to synchronize with the directory.
    recurrence String
    source String
    Authoritative source of data during the sync (data will move from the source to the destination). Can be one of: directory, key-prefix
    synchronizedDirectoryId String
    The ID of this resource.

    Package Details

    Repository
    etcd ferlab-ste-justine/terraform-provider-etcd
    License
    Notes
    This Pulumi package is based on the etcd Terraform Provider.
    etcd logo
    etcd 0.10.0 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine