1. Packages
  2. Packages
  3. Lxd Provider
  4. API Docs
  5. StorageVolumeCopy
Viewing docs for lxd 3.0.2
published on Monday, Jun 29, 2026 by terraform-lxd
Viewing docs for lxd 3.0.2
published on Monday, Jun 29, 2026 by terraform-lxd

    # lxd.StorageVolumeCopy

    Copies an existing LXD storage volume.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as lxd from "@pulumi/lxd";
    
    const pool1 = new lxd.StoragePool("pool1", {
        name: "mypool",
        driver: "dir",
    });
    const volume1 = new lxd.StorageVolume("volume1", {
        name: "myvolume",
        pool: pool1.name,
    });
    const volume1Copy = new lxd.StorageVolumeCopy("volume1_copy", {
        name: "myvolume_copy",
        pool: pool1.name,
        sourcePool: pool1.name,
        sourceName: volume1.name,
    });
    
    import pulumi
    import pulumi_lxd as lxd
    
    pool1 = lxd.StoragePool("pool1",
        name="mypool",
        driver="dir")
    volume1 = lxd.StorageVolume("volume1",
        name="myvolume",
        pool=pool1.name)
    volume1_copy = lxd.StorageVolumeCopy("volume1_copy",
        name="myvolume_copy",
        pool=pool1.name,
        source_pool=pool1.name,
        source_name=volume1.name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/lxd/v3/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{
    			Name:   pulumi.String("mypool"),
    			Driver: pulumi.String("dir"),
    		})
    		if err != nil {
    			return err
    		}
    		volume1, err := lxd.NewStorageVolume(ctx, "volume1", &lxd.StorageVolumeArgs{
    			Name: pulumi.String("myvolume"),
    			Pool: pool1.Name,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = lxd.NewStorageVolumeCopy(ctx, "volume1_copy", &lxd.StorageVolumeCopyArgs{
    			Name:       pulumi.String("myvolume_copy"),
    			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()
        {
            Name = "mypool",
            Driver = "dir",
        });
    
        var volume1 = new Lxd.StorageVolume("volume1", new()
        {
            Name = "myvolume",
            Pool = pool1.Name,
        });
    
        var volume1Copy = new Lxd.StorageVolumeCopy("volume1_copy", new()
        {
            Name = "myvolume_copy",
            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.StorageVolume;
    import com.pulumi.lxd.StorageVolumeArgs;
    import com.pulumi.lxd.StorageVolumeCopy;
    import com.pulumi.lxd.StorageVolumeCopyArgs;
    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()
                .name("mypool")
                .driver("dir")
                .build());
    
            var volume1 = new StorageVolume("volume1", StorageVolumeArgs.builder()
                .name("myvolume")
                .pool(pool1.name())
                .build());
    
            var volume1Copy = new StorageVolumeCopy("volume1Copy", StorageVolumeCopyArgs.builder()
                .name("myvolume_copy")
                .pool(pool1.name())
                .sourcePool(pool1.name())
                .sourceName(volume1.name())
                .build());
    
        }
    }
    
    resources:
      pool1:
        type: lxd:StoragePool
        properties:
          name: mypool
          driver: dir
      volume1:
        type: lxd:StorageVolume
        properties:
          name: myvolume
          pool: ${pool1.name}
      volume1Copy:
        type: lxd:StorageVolumeCopy
        name: volume1_copy
        properties:
          name: myvolume_copy
          pool: ${pool1.name}
          sourcePool: ${pool1.name}
          sourceName: ${volume1.name}
    
    Example coming soon!
    

    Notes

    Create StorageVolumeCopy Resource

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

    Constructor syntax

    new StorageVolumeCopy(name: string, args: StorageVolumeCopyArgs, opts?: CustomResourceOptions);
    @overload
    def StorageVolumeCopy(resource_name: str,
                          args: StorageVolumeCopyArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def StorageVolumeCopy(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_project: Optional[str] = None,
                          source_remote: Optional[str] = None,
                          target: Optional[str] = None)
    func NewStorageVolumeCopy(ctx *Context, name string, args StorageVolumeCopyArgs, opts ...ResourceOption) (*StorageVolumeCopy, error)
    public StorageVolumeCopy(string name, StorageVolumeCopyArgs args, CustomResourceOptions? opts = null)
    public StorageVolumeCopy(String name, StorageVolumeCopyArgs args)
    public StorageVolumeCopy(String name, StorageVolumeCopyArgs args, CustomResourceOptions options)
    
    type: lxd:StorageVolumeCopy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "lxd_storagevolumecopy" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args StorageVolumeCopyArgs
    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 StorageVolumeCopyArgs
    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 StorageVolumeCopyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args StorageVolumeCopyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args StorageVolumeCopyArgs
    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 storageVolumeCopyResource = new Lxd.StorageVolumeCopy("storageVolumeCopyResource", new()
    {
        Pool = "string",
        SourceName = "string",
        SourcePool = "string",
        Name = "string",
        Project = "string",
        Remote = "string",
        SourceProject = "string",
        SourceRemote = "string",
        Target = "string",
    });
    
    example, err := lxd.NewStorageVolumeCopy(ctx, "storageVolumeCopyResource", &lxd.StorageVolumeCopyArgs{
    	Pool:          pulumi.String("string"),
    	SourceName:    pulumi.String("string"),
    	SourcePool:    pulumi.String("string"),
    	Name:          pulumi.String("string"),
    	Project:       pulumi.String("string"),
    	Remote:        pulumi.String("string"),
    	SourceProject: pulumi.String("string"),
    	SourceRemote:  pulumi.String("string"),
    	Target:        pulumi.String("string"),
    })
    
    resource "lxd_storagevolumecopy" "storageVolumeCopyResource" {
      pool           = "string"
      source_name    = "string"
      source_pool    = "string"
      name           = "string"
      project        = "string"
      remote         = "string"
      source_project = "string"
      source_remote  = "string"
      target         = "string"
    }
    
    var storageVolumeCopyResource = new StorageVolumeCopy("storageVolumeCopyResource", StorageVolumeCopyArgs.builder()
        .pool("string")
        .sourceName("string")
        .sourcePool("string")
        .name("string")
        .project("string")
        .remote("string")
        .sourceProject("string")
        .sourceRemote("string")
        .target("string")
        .build());
    
    storage_volume_copy_resource = lxd.StorageVolumeCopy("storageVolumeCopyResource",
        pool="string",
        source_name="string",
        source_pool="string",
        name="string",
        project="string",
        remote="string",
        source_project="string",
        source_remote="string",
        target="string")
    
    const storageVolumeCopyResource = new lxd.StorageVolumeCopy("storageVolumeCopyResource", {
        pool: "string",
        sourceName: "string",
        sourcePool: "string",
        name: "string",
        project: "string",
        remote: "string",
        sourceProject: "string",
        sourceRemote: "string",
        target: "string",
    });
    
    type: lxd:StorageVolumeCopy
    properties:
        name: string
        pool: string
        project: string
        remote: string
        sourceName: string
        sourcePool: string
        sourceProject: string
        sourceRemote: string
        target: string
    

    StorageVolumeCopy 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 StorageVolumeCopy 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.
    SourceProject string
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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.
    SourceProject string
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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.
    source_name string
    Required - Name of the existing storage volume that is to be copied.
    source_pool 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.
    source_project string
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    source_remote 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.
    sourceProject String
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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.
    sourceProject string
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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_project str
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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.
    sourceProject String
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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 StorageVolumeCopy 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 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 StorageVolumeCopy Resource

    Get an existing StorageVolumeCopy 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?: StorageVolumeCopyState, opts?: CustomResourceOptions): StorageVolumeCopy
    @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_project: Optional[str] = None,
            source_remote: Optional[str] = None,
            target: Optional[str] = None) -> StorageVolumeCopy
    func GetStorageVolumeCopy(ctx *Context, name string, id IDInput, state *StorageVolumeCopyState, opts ...ResourceOption) (*StorageVolumeCopy, error)
    public static StorageVolumeCopy Get(string name, Input<string> id, StorageVolumeCopyState? state, CustomResourceOptions? opts = null)
    public static StorageVolumeCopy get(String name, Output<String> id, StorageVolumeCopyState state, CustomResourceOptions options)
    resources:  _:    type: lxd:StorageVolumeCopy    get:      id: ${id}
    import {
      to = lxd_storagevolumecopy.example
      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.
    SourceProject string
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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.
    SourceProject string
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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.
    source_name string
    Required - Name of the existing storage volume that is to be copied.
    source_pool string
    Required - The storage pool that hosts the existing volume to use as the source.
    source_project string
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    source_remote 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.
    sourceProject String
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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.
    sourceProject string
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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_project str
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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.
    sourceProject String
    Optional - Name of the project from which the source volume is copied. Defaults to default.
    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.
    Viewing docs for lxd 3.0.2
    published on Monday, Jun 29, 2026 by terraform-lxd

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial