1. Packages
  2. Ionoscloud Provider
  3. API Docs
  4. getVolume
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

ionoscloud.getVolume

Explore with Pulumi AI

ionoscloud logo
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

    The volume data source can be used to search for and return existing volumes. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.

    Example Usage

    By ID

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getVolume({
        datacenterId: "datacenter_id",
        id: "volume_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_volume(datacenter_id="datacenter_id",
        id="volume_id")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ionoscloud.LookupVolume(ctx, &ionoscloud.LookupVolumeArgs{
    			DatacenterId: "datacenter_id",
    			Id:           pulumi.StringRef("volume_id"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetVolume.Invoke(new()
        {
            DatacenterId = "datacenter_id",
            Id = "volume_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetVolumeArgs;
    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) {
            final var example = IonoscloudFunctions.getVolume(GetVolumeArgs.builder()
                .datacenterId("datacenter_id")
                .id("volume_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getVolume
          arguments:
            datacenterId: datacenter_id
            id: volume_id
    

    By Name

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getVolume({
        datacenterId: "datacenter_id",
        name: "Volume Example",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_volume(datacenter_id="datacenter_id",
        name="Volume Example")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ionoscloud.LookupVolume(ctx, &ionoscloud.LookupVolumeArgs{
    			DatacenterId: "datacenter_id",
    			Name:         pulumi.StringRef("Volume Example"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetVolume.Invoke(new()
        {
            DatacenterId = "datacenter_id",
            Name = "Volume Example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetVolumeArgs;
    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) {
            final var example = IonoscloudFunctions.getVolume(GetVolumeArgs.builder()
                .datacenterId("datacenter_id")
                .name("Volume Example")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getVolume
          arguments:
            datacenterId: datacenter_id
            name: Volume Example
    

    Using getVolume

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getVolume(args: GetVolumeArgs, opts?: InvokeOptions): Promise<GetVolumeResult>
    function getVolumeOutput(args: GetVolumeOutputArgs, opts?: InvokeOptions): Output<GetVolumeResult>
    def get_volume(datacenter_id: Optional[str] = None,
                   id: Optional[str] = None,
                   name: Optional[str] = None,
                   timeouts: Optional[GetVolumeTimeouts] = None,
                   opts: Optional[InvokeOptions] = None) -> GetVolumeResult
    def get_volume_output(datacenter_id: Optional[pulumi.Input[str]] = None,
                   id: Optional[pulumi.Input[str]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   timeouts: Optional[pulumi.Input[GetVolumeTimeoutsArgs]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetVolumeResult]
    func LookupVolume(ctx *Context, args *LookupVolumeArgs, opts ...InvokeOption) (*LookupVolumeResult, error)
    func LookupVolumeOutput(ctx *Context, args *LookupVolumeOutputArgs, opts ...InvokeOption) LookupVolumeResultOutput

    > Note: This function is named LookupVolume in the Go SDK.

    public static class GetVolume 
    {
        public static Task<GetVolumeResult> InvokeAsync(GetVolumeArgs args, InvokeOptions? opts = null)
        public static Output<GetVolumeResult> Invoke(GetVolumeInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVolumeResult> getVolume(GetVolumeArgs args, InvokeOptions options)
    public static Output<GetVolumeResult> getVolume(GetVolumeArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:index/getVolume:getVolume
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DatacenterId string
    Id string

    ID of the volume you want to search for.

    Either volume or id must be provided. If none, or both are provided, the datasource will return an error.

    Name string
    Name of an existing volume that you want to search for.
    Timeouts GetVolumeTimeouts
    DatacenterId string
    Id string

    ID of the volume you want to search for.

    Either volume or id must be provided. If none, or both are provided, the datasource will return an error.

    Name string
    Name of an existing volume that you want to search for.
    Timeouts GetVolumeTimeouts
    datacenterId String
    id String

    ID of the volume you want to search for.

    Either volume or id must be provided. If none, or both are provided, the datasource will return an error.

    name String
    Name of an existing volume that you want to search for.
    timeouts GetVolumeTimeouts
    datacenterId string
    id string

    ID of the volume you want to search for.

    Either volume or id must be provided. If none, or both are provided, the datasource will return an error.

    name string
    Name of an existing volume that you want to search for.
    timeouts GetVolumeTimeouts
    datacenter_id str
    id str

    ID of the volume you want to search for.

    Either volume or id must be provided. If none, or both are provided, the datasource will return an error.

    name str
    Name of an existing volume that you want to search for.
    timeouts GetVolumeTimeouts
    datacenterId String
    id String

    ID of the volume you want to search for.

    Either volume or id must be provided. If none, or both are provided, the datasource will return an error.

    name String
    Name of an existing volume that you want to search for.
    timeouts Property Map

    getVolume Result

    The following output properties are available:

    AvailabilityZone string
    The storage availability zone assigned to the volume: AUTO, ZONE_1, ZONE_2, or ZONE_3. This property is immutable.
    BackupUnitId string
    The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either 'public image' or 'imageAlias' in conjunction with this property.
    BootServer string
    The UUID of the attached server.
    Bus string
    The bus type of the volume: VIRTIO or IDE.
    CpuHotPlug bool
    Is capable of CPU hot plug (no reboot required)
    DatacenterId string
    DeviceNumber double
    The LUN ID of the storage volume. Null for volumes not mounted to any VM
    DiscVirtioHotPlug bool
    Is capable of Virt-IO drive hot plug (no reboot required)
    DiscVirtioHotUnplug bool
    Is capable of Virt-IO drive hot unplug (no reboot required). This works only for non-Windows virtual Machines.
    DiskType string
    The volume type: HDD or SSD.
    Id string
    The id of the volume.
    Image string
    The image or snapshot UUID.
    ImagePassword string
    Required if sshkey_path is not provided.
    LicenceType string
    The type of the licence.
    Name string
    The name of the volume.
    NicHotPlug bool
    Is capable of nic hot plug (no reboot required)
    NicHotUnplug bool
    Is capable of nic hot unplug (no reboot required)
    RamHotPlug bool
    Is capable of memory hot plug (no reboot required)
    Size double
    The size of the volume in GB.
    Sshkey string
    The associated public SSH key.
    UserData string
    The cloud-init configuration for the volume as base64 encoded string. The property is immutable and is only allowed to be set on a new volume creation. This option will work only with cloud-init compatible images.
    Timeouts GetVolumeTimeouts
    AvailabilityZone string
    The storage availability zone assigned to the volume: AUTO, ZONE_1, ZONE_2, or ZONE_3. This property is immutable.
    BackupUnitId string
    The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either 'public image' or 'imageAlias' in conjunction with this property.
    BootServer string
    The UUID of the attached server.
    Bus string
    The bus type of the volume: VIRTIO or IDE.
    CpuHotPlug bool
    Is capable of CPU hot plug (no reboot required)
    DatacenterId string
    DeviceNumber float64
    The LUN ID of the storage volume. Null for volumes not mounted to any VM
    DiscVirtioHotPlug bool
    Is capable of Virt-IO drive hot plug (no reboot required)
    DiscVirtioHotUnplug bool
    Is capable of Virt-IO drive hot unplug (no reboot required). This works only for non-Windows virtual Machines.
    DiskType string
    The volume type: HDD or SSD.
    Id string
    The id of the volume.
    Image string
    The image or snapshot UUID.
    ImagePassword string
    Required if sshkey_path is not provided.
    LicenceType string
    The type of the licence.
    Name string
    The name of the volume.
    NicHotPlug bool
    Is capable of nic hot plug (no reboot required)
    NicHotUnplug bool
    Is capable of nic hot unplug (no reboot required)
    RamHotPlug bool
    Is capable of memory hot plug (no reboot required)
    Size float64
    The size of the volume in GB.
    Sshkey string
    The associated public SSH key.
    UserData string
    The cloud-init configuration for the volume as base64 encoded string. The property is immutable and is only allowed to be set on a new volume creation. This option will work only with cloud-init compatible images.
    Timeouts GetVolumeTimeouts
    availabilityZone String
    The storage availability zone assigned to the volume: AUTO, ZONE_1, ZONE_2, or ZONE_3. This property is immutable.
    backupUnitId String
    The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either 'public image' or 'imageAlias' in conjunction with this property.
    bootServer String
    The UUID of the attached server.
    bus String
    The bus type of the volume: VIRTIO or IDE.
    cpuHotPlug Boolean
    Is capable of CPU hot plug (no reboot required)
    datacenterId String
    deviceNumber Double
    The LUN ID of the storage volume. Null for volumes not mounted to any VM
    discVirtioHotPlug Boolean
    Is capable of Virt-IO drive hot plug (no reboot required)
    discVirtioHotUnplug Boolean
    Is capable of Virt-IO drive hot unplug (no reboot required). This works only for non-Windows virtual Machines.
    diskType String
    The volume type: HDD or SSD.
    id String
    The id of the volume.
    image String
    The image or snapshot UUID.
    imagePassword String
    Required if sshkey_path is not provided.
    licenceType String
    The type of the licence.
    name String
    The name of the volume.
    nicHotPlug Boolean
    Is capable of nic hot plug (no reboot required)
    nicHotUnplug Boolean
    Is capable of nic hot unplug (no reboot required)
    ramHotPlug Boolean
    Is capable of memory hot plug (no reboot required)
    size Double
    The size of the volume in GB.
    sshkey String
    The associated public SSH key.
    userData String
    The cloud-init configuration for the volume as base64 encoded string. The property is immutable and is only allowed to be set on a new volume creation. This option will work only with cloud-init compatible images.
    timeouts GetVolumeTimeouts
    availabilityZone string
    The storage availability zone assigned to the volume: AUTO, ZONE_1, ZONE_2, or ZONE_3. This property is immutable.
    backupUnitId string
    The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either 'public image' or 'imageAlias' in conjunction with this property.
    bootServer string
    The UUID of the attached server.
    bus string
    The bus type of the volume: VIRTIO or IDE.
    cpuHotPlug boolean
    Is capable of CPU hot plug (no reboot required)
    datacenterId string
    deviceNumber number
    The LUN ID of the storage volume. Null for volumes not mounted to any VM
    discVirtioHotPlug boolean
    Is capable of Virt-IO drive hot plug (no reboot required)
    discVirtioHotUnplug boolean
    Is capable of Virt-IO drive hot unplug (no reboot required). This works only for non-Windows virtual Machines.
    diskType string
    The volume type: HDD or SSD.
    id string
    The id of the volume.
    image string
    The image or snapshot UUID.
    imagePassword string
    Required if sshkey_path is not provided.
    licenceType string
    The type of the licence.
    name string
    The name of the volume.
    nicHotPlug boolean
    Is capable of nic hot plug (no reboot required)
    nicHotUnplug boolean
    Is capable of nic hot unplug (no reboot required)
    ramHotPlug boolean
    Is capable of memory hot plug (no reboot required)
    size number
    The size of the volume in GB.
    sshkey string
    The associated public SSH key.
    userData string
    The cloud-init configuration for the volume as base64 encoded string. The property is immutable and is only allowed to be set on a new volume creation. This option will work only with cloud-init compatible images.
    timeouts GetVolumeTimeouts
    availability_zone str
    The storage availability zone assigned to the volume: AUTO, ZONE_1, ZONE_2, or ZONE_3. This property is immutable.
    backup_unit_id str
    The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either 'public image' or 'imageAlias' in conjunction with this property.
    boot_server str
    The UUID of the attached server.
    bus str
    The bus type of the volume: VIRTIO or IDE.
    cpu_hot_plug bool
    Is capable of CPU hot plug (no reboot required)
    datacenter_id str
    device_number float
    The LUN ID of the storage volume. Null for volumes not mounted to any VM
    disc_virtio_hot_plug bool
    Is capable of Virt-IO drive hot plug (no reboot required)
    disc_virtio_hot_unplug bool
    Is capable of Virt-IO drive hot unplug (no reboot required). This works only for non-Windows virtual Machines.
    disk_type str
    The volume type: HDD or SSD.
    id str
    The id of the volume.
    image str
    The image or snapshot UUID.
    image_password str
    Required if sshkey_path is not provided.
    licence_type str
    The type of the licence.
    name str
    The name of the volume.
    nic_hot_plug bool
    Is capable of nic hot plug (no reboot required)
    nic_hot_unplug bool
    Is capable of nic hot unplug (no reboot required)
    ram_hot_plug bool
    Is capable of memory hot plug (no reboot required)
    size float
    The size of the volume in GB.
    sshkey str
    The associated public SSH key.
    user_data str
    The cloud-init configuration for the volume as base64 encoded string. The property is immutable and is only allowed to be set on a new volume creation. This option will work only with cloud-init compatible images.
    timeouts GetVolumeTimeouts
    availabilityZone String
    The storage availability zone assigned to the volume: AUTO, ZONE_1, ZONE_2, or ZONE_3. This property is immutable.
    backupUnitId String
    The uuid of the Backup Unit that user has access to. The property is immutable and is only allowed to be set on a new volume creation. It is mandatory to provide either 'public image' or 'imageAlias' in conjunction with this property.
    bootServer String
    The UUID of the attached server.
    bus String
    The bus type of the volume: VIRTIO or IDE.
    cpuHotPlug Boolean
    Is capable of CPU hot plug (no reboot required)
    datacenterId String
    deviceNumber Number
    The LUN ID of the storage volume. Null for volumes not mounted to any VM
    discVirtioHotPlug Boolean
    Is capable of Virt-IO drive hot plug (no reboot required)
    discVirtioHotUnplug Boolean
    Is capable of Virt-IO drive hot unplug (no reboot required). This works only for non-Windows virtual Machines.
    diskType String
    The volume type: HDD or SSD.
    id String
    The id of the volume.
    image String
    The image or snapshot UUID.
    imagePassword String
    Required if sshkey_path is not provided.
    licenceType String
    The type of the licence.
    name String
    The name of the volume.
    nicHotPlug Boolean
    Is capable of nic hot plug (no reboot required)
    nicHotUnplug Boolean
    Is capable of nic hot unplug (no reboot required)
    ramHotPlug Boolean
    Is capable of memory hot plug (no reboot required)
    size Number
    The size of the volume in GB.
    sshkey String
    The associated public SSH key.
    userData String
    The cloud-init configuration for the volume as base64 encoded string. The property is immutable and is only allowed to be set on a new volume creation. This option will work only with cloud-init compatible images.
    timeouts Property Map

    Supporting Types

    GetVolumeTimeouts

    Create string
    Default string
    Delete string
    Update string
    Create string
    Default string
    Delete string
    Update string
    create String
    default_ String
    delete String
    update String
    create string
    default string
    delete string
    update string
    create String
    default String
    delete String
    update String

    Package Details

    Repository
    ionoscloud ionos-cloud/terraform-provider-ionoscloud
    License
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud