1. Packages
  2. Ucloud Provider
  3. API Docs
  4. getDisks
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

ucloud.getDisks

Explore with Pulumi AI

ucloud logo
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

    This data source provides a list of Disk resources according to their Disk ID and disk type.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ucloud from "@pulumi/ucloud";
    
    const example = ucloud.getDisks({});
    export const first = example.then(example => example.disks?.[0]?.id);
    
    import pulumi
    import pulumi_ucloud as ucloud
    
    example = ucloud.get_disks()
    pulumi.export("first", example.disks[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ucloud.GetDisks(ctx, &ucloud.GetDisksArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("first", example.Disks[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ucloud = Pulumi.Ucloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ucloud.GetDisks.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["first"] = example.Apply(getDisksResult => getDisksResult.Disks[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ucloud.UcloudFunctions;
    import com.pulumi.ucloud.inputs.GetDisksArgs;
    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 = UcloudFunctions.getDisks();
    
            ctx.export("first", example.applyValue(getDisksResult -> getDisksResult.disks()[0].id()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ucloud:getDisks
          arguments: {}
    outputs:
      first: ${example.disks[0].id}
    

    Using getDisks

    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 getDisks(args: GetDisksArgs, opts?: InvokeOptions): Promise<GetDisksResult>
    function getDisksOutput(args: GetDisksOutputArgs, opts?: InvokeOptions): Output<GetDisksResult>
    def get_disks(availability_zone: Optional[str] = None,
                  disk_type: Optional[str] = None,
                  id: Optional[str] = None,
                  ids: Optional[Sequence[str]] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetDisksResult
    def get_disks_output(availability_zone: Optional[pulumi.Input[str]] = None,
                  disk_type: Optional[pulumi.Input[str]] = None,
                  id: Optional[pulumi.Input[str]] = None,
                  ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  name_regex: Optional[pulumi.Input[str]] = None,
                  output_file: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetDisksResult]
    func GetDisks(ctx *Context, args *GetDisksArgs, opts ...InvokeOption) (*GetDisksResult, error)
    func GetDisksOutput(ctx *Context, args *GetDisksOutputArgs, opts ...InvokeOption) GetDisksResultOutput

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

    public static class GetDisks 
    {
        public static Task<GetDisksResult> InvokeAsync(GetDisksArgs args, InvokeOptions? opts = null)
        public static Output<GetDisksResult> Invoke(GetDisksInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDisksResult> getDisks(GetDisksArgs args, InvokeOptions options)
    public static Output<GetDisksResult> getDisks(GetDisksArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ucloud:index/getDisks:getDisks
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AvailabilityZone string
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    DiskType string
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    Id string
    The ID of Disk.
    Ids List<string>
    A list of Disk IDs, all the Disks belong to this region will be retrieved if the ID is [].
    NameRegex string
    A regex string to filter resulting disks by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    AvailabilityZone string
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    DiskType string
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    Id string
    The ID of Disk.
    Ids []string
    A list of Disk IDs, all the Disks belong to this region will be retrieved if the ID is [].
    NameRegex string
    A regex string to filter resulting disks by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    availabilityZone String
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    diskType String
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    id String
    The ID of Disk.
    ids List<String>
    A list of Disk IDs, all the Disks belong to this region will be retrieved if the ID is [].
    nameRegex String
    A regex string to filter resulting disks by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    availabilityZone string
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    diskType string
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    id string
    The ID of Disk.
    ids string[]
    A list of Disk IDs, all the Disks belong to this region will be retrieved if the ID is [].
    nameRegex string
    A regex string to filter resulting disks by name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    availability_zone str
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    disk_type str
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    id str
    The ID of Disk.
    ids Sequence[str]
    A list of Disk IDs, all the Disks belong to this region will be retrieved if the ID is [].
    name_regex str
    A regex string to filter resulting disks by name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    availabilityZone String
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    diskType String
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    id String
    The ID of Disk.
    ids List<String>
    A list of Disk IDs, all the Disks belong to this region will be retrieved if the ID is [].
    nameRegex String
    A regex string to filter resulting disks by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getDisks Result

    The following output properties are available:

    Disks List<GetDisksDisk>
    It is a nested type which documented below.
    Id string
    The ID of Disk.
    Ids List<string>
    TotalCount double
    Total number of Disks that satisfy the condition.
    AvailabilityZone string
    Availability zone where disk is located.
    DiskType string
    The type of disk.
    NameRegex string
    OutputFile string
    Disks []GetDisksDisk
    It is a nested type which documented below.
    Id string
    The ID of Disk.
    Ids []string
    TotalCount float64
    Total number of Disks that satisfy the condition.
    AvailabilityZone string
    Availability zone where disk is located.
    DiskType string
    The type of disk.
    NameRegex string
    OutputFile string
    disks List<GetDisksDisk>
    It is a nested type which documented below.
    id String
    The ID of Disk.
    ids List<String>
    totalCount Double
    Total number of Disks that satisfy the condition.
    availabilityZone String
    Availability zone where disk is located.
    diskType String
    The type of disk.
    nameRegex String
    outputFile String
    disks GetDisksDisk[]
    It is a nested type which documented below.
    id string
    The ID of Disk.
    ids string[]
    totalCount number
    Total number of Disks that satisfy the condition.
    availabilityZone string
    Availability zone where disk is located.
    diskType string
    The type of disk.
    nameRegex string
    outputFile string
    disks Sequence[GetDisksDisk]
    It is a nested type which documented below.
    id str
    The ID of Disk.
    ids Sequence[str]
    total_count float
    Total number of Disks that satisfy the condition.
    availability_zone str
    Availability zone where disk is located.
    disk_type str
    The type of disk.
    name_regex str
    output_file str
    disks List<Property Map>
    It is a nested type which documented below.
    id String
    The ID of Disk.
    ids List<String>
    totalCount Number
    Total number of Disks that satisfy the condition.
    availabilityZone String
    Availability zone where disk is located.
    diskType String
    The type of disk.
    nameRegex String
    outputFile String

    Supporting Types

    GetDisksDisk

    AvailabilityZone string
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    ChargeType string
    The charge type of disk. Possible values are: year as pay by year, month as pay by month, dynamic as pay by hour.
    CreateTime string
    The creation time of Disk, formatted in RFC3339 time string.
    DiskSize double
    The size of disk. Purchase the size of disk in GB.
    DiskType string
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    ExpireTime string
    The expiration time of disk, formatted in RFC3339 time string.
    Id string
    The ID of Disk.
    Name string
    The name of Disk.
    Status string
    The status of disk. Possible values are: Available, InUse, Detaching, Initializating, Failed, Cloning, Restoring, RestoreFailed.
    Tag string
    A tag assigned to Disk.
    AvailabilityZone string
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    ChargeType string
    The charge type of disk. Possible values are: year as pay by year, month as pay by month, dynamic as pay by hour.
    CreateTime string
    The creation time of Disk, formatted in RFC3339 time string.
    DiskSize float64
    The size of disk. Purchase the size of disk in GB.
    DiskType string
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    ExpireTime string
    The expiration time of disk, formatted in RFC3339 time string.
    Id string
    The ID of Disk.
    Name string
    The name of Disk.
    Status string
    The status of disk. Possible values are: Available, InUse, Detaching, Initializating, Failed, Cloning, Restoring, RestoreFailed.
    Tag string
    A tag assigned to Disk.
    availabilityZone String
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    chargeType String
    The charge type of disk. Possible values are: year as pay by year, month as pay by month, dynamic as pay by hour.
    createTime String
    The creation time of Disk, formatted in RFC3339 time string.
    diskSize Double
    The size of disk. Purchase the size of disk in GB.
    diskType String
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    expireTime String
    The expiration time of disk, formatted in RFC3339 time string.
    id String
    The ID of Disk.
    name String
    The name of Disk.
    status String
    The status of disk. Possible values are: Available, InUse, Detaching, Initializating, Failed, Cloning, Restoring, RestoreFailed.
    tag String
    A tag assigned to Disk.
    availabilityZone string
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    chargeType string
    The charge type of disk. Possible values are: year as pay by year, month as pay by month, dynamic as pay by hour.
    createTime string
    The creation time of Disk, formatted in RFC3339 time string.
    diskSize number
    The size of disk. Purchase the size of disk in GB.
    diskType string
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    expireTime string
    The expiration time of disk, formatted in RFC3339 time string.
    id string
    The ID of Disk.
    name string
    The name of Disk.
    status string
    The status of disk. Possible values are: Available, InUse, Detaching, Initializating, Failed, Cloning, Restoring, RestoreFailed.
    tag string
    A tag assigned to Disk.
    availability_zone str
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    charge_type str
    The charge type of disk. Possible values are: year as pay by year, month as pay by month, dynamic as pay by hour.
    create_time str
    The creation time of Disk, formatted in RFC3339 time string.
    disk_size float
    The size of disk. Purchase the size of disk in GB.
    disk_type str
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    expire_time str
    The expiration time of disk, formatted in RFC3339 time string.
    id str
    The ID of Disk.
    name str
    The name of Disk.
    status str
    The status of disk. Possible values are: Available, InUse, Detaching, Initializating, Failed, Cloning, Restoring, RestoreFailed.
    tag str
    A tag assigned to Disk.
    availabilityZone String
    Availability zone where Disk are located. Such as: "cn-bj2-02". You may refer to list of availability zone
    chargeType String
    The charge type of disk. Possible values are: year as pay by year, month as pay by month, dynamic as pay by hour.
    createTime String
    The creation time of Disk, formatted in RFC3339 time string.
    diskSize Number
    The size of disk. Purchase the size of disk in GB.
    diskType String
    The type of disk. Possible values are: data_diskas cloud disk, ssd_data_disk as SSD cloud disk, system_diskas system disk, ssd_system_disk as SSD system disk, rssd_data_disk as RDMA-SSD cloud disk.
    expireTime String
    The expiration time of disk, formatted in RFC3339 time string.
    id String
    The ID of Disk.
    name String
    The name of Disk.
    status String
    The status of disk. Possible values are: Available, InUse, Detaching, Initializating, Failed, Cloning, Restoring, RestoreFailed.
    tag String
    A tag assigned to Disk.

    Package Details

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