1. Packages
  2. Lxd Provider
  3. API Docs
  4. VolumeCopy
lxd 2.5.0 published on Thursday, Mar 13, 2025 by terraform-lxd

lxd.VolumeCopy

Explore with Pulumi AI

lxd logo
lxd 2.5.0 published on Thursday, Mar 13, 2025 by terraform-lxd

    # lxd.VolumeCopy

    Copies an existing LXD volume.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as lxd from "@pulumi/lxd";
    
    const pool1 = new lxd.StoragePool("pool1", {driver: "dir"});
    const volume1 = new lxd.Volume("volume1", {pool: pool1.name});
    const volume1Copy = new lxd.VolumeCopy("volume1Copy", {
        pool: pool1.name,
        sourcePool: pool1.name,
        sourceName: volume1.name,
    });
    
    import pulumi
    import pulumi_lxd as lxd
    
    pool1 = lxd.StoragePool("pool1", driver="dir")
    volume1 = lxd.Volume("volume1", pool=pool1.name)
    volume1_copy = lxd.VolumeCopy("volume1Copy",
        pool=pool1.name,
        source_pool=pool1.name,
        source_name=volume1.name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/lxd/v2/lxd"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		pool1, err := lxd.NewStoragePool(ctx, "pool1", &lxd.StoragePoolArgs{
    			Driver: pulumi.String("dir"),
    		})
    		if err != nil {
    			return err
    		}
    		volume1, err := lxd.NewVolume(ctx, "volume1", &lxd.VolumeArgs{
    			Pool: pool1.Name,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = lxd.NewVolumeCopy(ctx, "volume1Copy", &lxd.VolumeCopyArgs{
    			Pool:       pool1.Name,
    			SourcePool: pool1.Name,
    			SourceName: volume1.Name,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Lxd = Pulumi.Lxd;
    
    return await Deployment.RunAsync(() => 
    {
        var pool1 = new Lxd.StoragePool("pool1", new()
        {
            Driver = "dir",
        });
    
        var volume1 = new Lxd.Volume("volume1", new()
        {
            Pool = pool1.Name,
        });
    
        var volume1Copy = new Lxd.VolumeCopy("volume1Copy", new()
        {
            Pool = pool1.Name,
            SourcePool = pool1.Name,
            SourceName = volume1.Name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.lxd.StoragePool;
    import com.pulumi.lxd.StoragePoolArgs;
    import com.pulumi.lxd.Volume;
    import com.pulumi.lxd.VolumeArgs;
    import com.pulumi.lxd.VolumeCopy;
    import com.pulumi.lxd.VolumeCopyArgs;
    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 pool1 = new StoragePool("pool1", StoragePoolArgs.builder()
                .driver("dir")
                .build());
    
            var volume1 = new Volume("volume1", VolumeArgs.builder()
                .pool(pool1.name())
                .build());
    
            var volume1Copy = new VolumeCopy("volume1Copy", VolumeCopyArgs.builder()
                .pool(pool1.name())
                .sourcePool(pool1.name())
                .sourceName(volume1.name())
                .build());
    
        }
    }
    
    resources:
      pool1:
        type: lxd:StoragePool
        properties:
          driver: dir
      volume1:
        type: lxd:Volume
        properties:
          pool: ${pool1.name}
      volume1Copy:
        type: lxd:VolumeCopy
        properties:
          pool: ${pool1.name}
          sourcePool: ${pool1.name}
          sourceName: ${volume1.name}
    

    Notes

    Create VolumeCopy Resource

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

    Constructor syntax

    new VolumeCopy(name: string, args: VolumeCopyArgs, opts?: CustomResourceOptions);
    @overload
    def VolumeCopy(resource_name: str,
                   args: VolumeCopyArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def VolumeCopy(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   pool: Optional[str] = None,
                   source_name: Optional[str] = None,
                   source_pool: Optional[str] = None,
                   name: Optional[str] = None,
                   project: Optional[str] = None,
                   remote: Optional[str] = None,
                   source_remote: Optional[str] = None,
                   target: Optional[str] = None)
    func NewVolumeCopy(ctx *Context, name string, args VolumeCopyArgs, opts ...ResourceOption) (*VolumeCopy, error)
    public VolumeCopy(string name, VolumeCopyArgs args, CustomResourceOptions? opts = null)
    public VolumeCopy(String name, VolumeCopyArgs args)
    public VolumeCopy(String name, VolumeCopyArgs args, CustomResourceOptions options)
    
    type: lxd:VolumeCopy
    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 VolumeCopyArgs
    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 VolumeCopyArgs
    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 VolumeCopyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VolumeCopyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VolumeCopyArgs
    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 volumeCopyResource = new Lxd.VolumeCopy("volumeCopyResource", new()
    {
        Pool = "string",
        SourceName = "string",
        SourcePool = "string",
        Name = "string",
        Project = "string",
        Remote = "string",
        SourceRemote = "string",
        Target = "string",
    });
    
    example, err := lxd.NewVolumeCopy(ctx, "volumeCopyResource", &lxd.VolumeCopyArgs{
    Pool: pulumi.String("string"),
    SourceName: pulumi.String("string"),
    SourcePool: pulumi.String("string"),
    Name: pulumi.String("string"),
    Project: pulumi.String("string"),
    Remote: pulumi.String("string"),
    SourceRemote: pulumi.String("string"),
    Target: pulumi.String("string"),
    })
    
    var volumeCopyResource = new VolumeCopy("volumeCopyResource", VolumeCopyArgs.builder()
        .pool("string")
        .sourceName("string")
        .sourcePool("string")
        .name("string")
        .project("string")
        .remote("string")
        .sourceRemote("string")
        .target("string")
        .build());
    
    volume_copy_resource = lxd.VolumeCopy("volumeCopyResource",
        pool="string",
        source_name="string",
        source_pool="string",
        name="string",
        project="string",
        remote="string",
        source_remote="string",
        target="string")
    
    const volumeCopyResource = new lxd.VolumeCopy("volumeCopyResource", {
        pool: "string",
        sourceName: "string",
        sourcePool: "string",
        name: "string",
        project: "string",
        remote: "string",
        sourceRemote: "string",
        target: "string",
    });
    
    type: lxd:VolumeCopy
    properties:
        name: string
        pool: string
        project: string
        remote: string
        sourceName: string
        sourcePool: string
        sourceRemote: string
        target: string
    

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

    Pool string
    Required - The storage pool that will receive the copy of the volume copy.
    SourceName string
    Required - Name of the existing storage volume that is to be copied.
    SourcePool string
    Required - The storage pool that hosts the existing volume to use as the source.
    Name string
    Required - Name of the storage volume.
    Project string
    Optional - Name of the target project where the volume will be copied to.
    Remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    SourceRemote string
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    Target string
    Optional - Specify a target node in a cluster.
    Pool string
    Required - The storage pool that will receive the copy of the volume copy.
    SourceName string
    Required - Name of the existing storage volume that is to be copied.
    SourcePool string
    Required - The storage pool that hosts the existing volume to use as the source.
    Name string
    Required - Name of the storage volume.
    Project string
    Optional - Name of the target project where the volume will be copied to.
    Remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    SourceRemote string
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    Target string
    Optional - Specify a target node in a cluster.
    pool String
    Required - The storage pool that will receive the copy of the volume copy.
    sourceName String
    Required - Name of the existing storage volume that is to be copied.
    sourcePool String
    Required - The storage pool that hosts the existing volume to use as the source.
    name String
    Required - Name of the storage volume.
    project String
    Optional - Name of the target project where the volume will be copied to.
    remote String
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    sourceRemote String
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    target String
    Optional - Specify a target node in a cluster.
    pool string
    Required - The storage pool that will receive the copy of the volume copy.
    sourceName string
    Required - Name of the existing storage volume that is to be copied.
    sourcePool string
    Required - The storage pool that hosts the existing volume to use as the source.
    name string
    Required - Name of the storage volume.
    project string
    Optional - Name of the target project where the volume will be copied to.
    remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    sourceRemote string
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    target string
    Optional - Specify a target node in a cluster.
    pool str
    Required - The storage pool that will receive the copy of the volume copy.
    source_name str
    Required - Name of the existing storage volume that is to be copied.
    source_pool str
    Required - The storage pool that hosts the existing volume to use as the source.
    name str
    Required - Name of the storage volume.
    project str
    Optional - Name of the target project where the volume will be copied to.
    remote str
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    source_remote str
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    target str
    Optional - Specify a target node in a cluster.
    pool String
    Required - The storage pool that will receive the copy of the volume copy.
    sourceName String
    Required - Name of the existing storage volume that is to be copied.
    sourcePool String
    Required - The storage pool that hosts the existing volume to use as the source.
    name String
    Required - Name of the storage volume.
    project String
    Optional - Name of the target project where the volume will be copied to.
    remote String
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    sourceRemote String
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    target String
    Optional - Specify a target node in a cluster.

    Outputs

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

    Get an existing VolumeCopy 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?: VolumeCopyState, opts?: CustomResourceOptions): VolumeCopy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            pool: Optional[str] = None,
            project: Optional[str] = None,
            remote: Optional[str] = None,
            source_name: Optional[str] = None,
            source_pool: Optional[str] = None,
            source_remote: Optional[str] = None,
            target: Optional[str] = None) -> VolumeCopy
    func GetVolumeCopy(ctx *Context, name string, id IDInput, state *VolumeCopyState, opts ...ResourceOption) (*VolumeCopy, error)
    public static VolumeCopy Get(string name, Input<string> id, VolumeCopyState? state, CustomResourceOptions? opts = null)
    public static VolumeCopy get(String name, Output<String> id, VolumeCopyState state, CustomResourceOptions options)
    resources:  _:    type: lxd:VolumeCopy    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:
    Name string
    Required - Name of the storage volume.
    Pool string
    Required - The storage pool that will receive the copy of the volume copy.
    Project string
    Optional - Name of the target project where the volume will be copied to.
    Remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    SourceName string
    Required - Name of the existing storage volume that is to be copied.
    SourcePool string
    Required - The storage pool that hosts the existing volume to use as the source.
    SourceRemote string
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    Target string
    Optional - Specify a target node in a cluster.
    Name string
    Required - Name of the storage volume.
    Pool string
    Required - The storage pool that will receive the copy of the volume copy.
    Project string
    Optional - Name of the target project where the volume will be copied to.
    Remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    SourceName string
    Required - Name of the existing storage volume that is to be copied.
    SourcePool string
    Required - The storage pool that hosts the existing volume to use as the source.
    SourceRemote string
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    Target string
    Optional - Specify a target node in a cluster.
    name String
    Required - Name of the storage volume.
    pool String
    Required - The storage pool that will receive the copy of the volume copy.
    project String
    Optional - Name of the target project where the volume will be copied to.
    remote String
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    sourceName String
    Required - Name of the existing storage volume that is to be copied.
    sourcePool String
    Required - The storage pool that hosts the existing volume to use as the source.
    sourceRemote String
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    target String
    Optional - Specify a target node in a cluster.
    name string
    Required - Name of the storage volume.
    pool string
    Required - The storage pool that will receive the copy of the volume copy.
    project string
    Optional - Name of the target project where the volume will be copied to.
    remote string
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    sourceName string
    Required - Name of the existing storage volume that is to be copied.
    sourcePool string
    Required - The storage pool that hosts the existing volume to use as the source.
    sourceRemote string
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    target string
    Optional - Specify a target node in a cluster.
    name str
    Required - Name of the storage volume.
    pool str
    Required - The storage pool that will receive the copy of the volume copy.
    project str
    Optional - Name of the target project where the volume will be copied to.
    remote str
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    source_name str
    Required - Name of the existing storage volume that is to be copied.
    source_pool str
    Required - The storage pool that hosts the existing volume to use as the source.
    source_remote str
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    target str
    Optional - Specify a target node in a cluster.
    name String
    Required - Name of the storage volume.
    pool String
    Required - The storage pool that will receive the copy of the volume copy.
    project String
    Optional - Name of the target project where the volume will be copied to.
    remote String
    Optional - The remote in which the resource will be created. If not provided, the provider's default remote will be used.
    sourceName String
    Required - Name of the existing storage volume that is to be copied.
    sourcePool String
    Required - The storage pool that hosts the existing volume to use as the source.
    sourceRemote String
    Optional - The remote from which the source volume is to be copied. If it is not provided, the default provider remote is used.
    target String
    Optional - Specify a target node in a cluster.

    Package Details

    Repository
    lxd terraform-lxd/terraform-provider-lxd
    License
    Notes
    This Pulumi package is based on the lxd Terraform Provider.
    lxd logo
    lxd 2.5.0 published on Thursday, Mar 13, 2025 by terraform-lxd