1. Registry
  2. Packages
  3. Ucloud Provider
  4. API Docs
  5. getDiskSnapshots
Viewing docs for ucloud 1.42.0
published on Friday, Sep 11, 2026 by ucloud
Viewing docs for ucloud 1.42.0
published on Friday, Sep 11, 2026 by ucloud

    This data source provides a list of Disk Snapshot resources according to their availability zone, source disk ID, snapshot ID and name.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ucloud from "@pulumi/ucloud";
    
    const example = ucloud.getDiskSnapshots({
        availabilityZone: "cn-bj2-02",
    });
    export const first = example.then(example => example.snapshots?.[0]?.id);
    
    import pulumi
    import pulumi_ucloud as ucloud
    
    example = ucloud.get_disk_snapshots(availability_zone="cn-bj2-02")
    pulumi.export("first", example.snapshots[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.GetDiskSnapshots(ctx, &ucloud.GetDiskSnapshotsArgs{
    			AvailabilityZone: pulumi.StringRef("cn-bj2-02"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("first", example.Snapshots[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ucloud = Pulumi.Ucloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ucloud.GetDiskSnapshots.Invoke(new()
        {
            AvailabilityZone = "cn-bj2-02",
        });
    
        return new Dictionary<string, object?>
        {
            ["first"] = example.Apply(getDiskSnapshotsResult => getDiskSnapshotsResult.Snapshots[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.GetDiskSnapshotsArgs;
    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.getDiskSnapshots(GetDiskSnapshotsArgs.builder()
                .availabilityZone("cn-bj2-02")
                .build());
    
            ctx.export("first", example.snapshots()[0].id());
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ucloud:getDiskSnapshots
          arguments:
            availabilityZone: cn-bj2-02
    outputs:
      first: ${example.snapshots[0].id}
    
    Example coming soon!
    

    Using getDiskSnapshots

    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 getDiskSnapshots(args: GetDiskSnapshotsArgs, opts?: InvokeOptions): Promise<GetDiskSnapshotsResult>
    function getDiskSnapshotsOutput(args: GetDiskSnapshotsOutputArgs, opts?: InvokeOutputOptions): Output<GetDiskSnapshotsResult>
    def get_disk_snapshots(availability_zone: Optional[str] = None,
                           disk_id: 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) -> GetDiskSnapshotsResult
    def get_disk_snapshots_output(availability_zone: pulumi.Input[Optional[str]] = None,
                           disk_id: pulumi.Input[Optional[str]] = None,
                           id: pulumi.Input[Optional[str]] = None,
                           ids: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                           name_regex: pulumi.Input[Optional[str]] = None,
                           output_file: pulumi.Input[Optional[str]] = None,
                           opts: Optional[InvokeOutputOptions] = None) -> Output[GetDiskSnapshotsResult]
    func GetDiskSnapshots(ctx *Context, args *GetDiskSnapshotsArgs, opts ...InvokeOption) (*GetDiskSnapshotsResult, error)
    func GetDiskSnapshotsOutput(ctx *Context, args *GetDiskSnapshotsOutputArgs, opts ...InvokeOption) GetDiskSnapshotsResultOutput

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

    public static class GetDiskSnapshots 
    {
        public static Task<GetDiskSnapshotsResult> InvokeAsync(GetDiskSnapshotsArgs args, InvokeOptions? opts = null)
        public static Output<GetDiskSnapshotsResult> Invoke(GetDiskSnapshotsInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetDiskSnapshotsResult> Invoke(GetDiskSnapshotsInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetDiskSnapshotsResult> getDiskSnapshots(GetDiskSnapshotsArgs args, InvokeOptions options)
    public static Output<GetDiskSnapshotsResult> getDiskSnapshots(GetDiskSnapshotsArgs args, InvokeOptions options)
    public static Output<GetDiskSnapshotsResult> getDiskSnapshots(GetDiskSnapshotsArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: ucloud:index/getDiskSnapshots:getDiskSnapshots
      arguments:
        # arguments dictionary
    data "ucloud_get_disk_snapshots" "name" {
        # arguments
    }

    The following arguments are supported:

    AvailabilityZone string
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    DiskId string
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    Id string
    The ID of the snapshot.
    Ids List<string>
    A list of snapshot IDs, all the snapshots belong to this region will be retrieved if the ID is [].
    NameRegex string
    A regex string to filter the resulting snapshots by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    AvailabilityZone string
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    DiskId string
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    Id string
    The ID of the snapshot.
    Ids []string
    A list of snapshot IDs, all the snapshots belong to this region will be retrieved if the ID is [].
    NameRegex string
    A regex string to filter the resulting snapshots by name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    availability_zone string
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    disk_id string
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    id string
    The ID of the snapshot.
    ids list(string)
    A list of snapshot IDs, all the snapshots belong to this region will be retrieved if the ID is [].
    name_regex string
    A regex string to filter the resulting snapshots by name.
    output_file string
    File name where to save data source results (after running pulumi preview).
    availabilityZone String
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    diskId String
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    id String
    The ID of the snapshot.
    ids List<String>
    A list of snapshot IDs, all the snapshots belong to this region will be retrieved if the ID is [].
    nameRegex String
    A regex string to filter the resulting snapshots by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    availabilityZone string
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    diskId string
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    id string
    The ID of the snapshot.
    ids string[]
    A list of snapshot IDs, all the snapshots belong to this region will be retrieved if the ID is [].
    nameRegex string
    A regex string to filter the resulting snapshots by name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    availability_zone str
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    disk_id str
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    id str
    The ID of the snapshot.
    ids Sequence[str]
    A list of snapshot IDs, all the snapshots belong to this region will be retrieved if the ID is [].
    name_regex str
    A regex string to filter the resulting snapshots by name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    availabilityZone String
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    diskId String
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    id String
    The ID of the snapshot.
    ids List<String>
    A list of snapshot IDs, all the snapshots belong to this region will be retrieved if the ID is [].
    nameRegex String
    A regex string to filter the resulting snapshots by name.
    outputFile String
    File name where to save data source results (after running pulumi preview).

    getDiskSnapshots Result

    The following output properties are available:

    Id string
    The ID of the snapshot.
    Ids List<string>
    Snapshots List<GetDiskSnapshotsSnapshot>
    It is a nested type which documented below.
    TotalCount double
    Total number of snapshots that satisfy the condition.
    AvailabilityZone string
    Availability zone where the snapshot is located.
    DiskId string
    The ID of the cloud disk which the snapshot is created from.
    NameRegex string
    OutputFile string
    Id string
    The ID of the snapshot.
    Ids []string
    Snapshots []GetDiskSnapshotsSnapshot
    It is a nested type which documented below.
    TotalCount float64
    Total number of snapshots that satisfy the condition.
    AvailabilityZone string
    Availability zone where the snapshot is located.
    DiskId string
    The ID of the cloud disk which the snapshot is created from.
    NameRegex string
    OutputFile string
    id string
    The ID of the snapshot.
    ids list(string)
    snapshots list(object)
    It is a nested type which documented below.
    total_count number
    Total number of snapshots that satisfy the condition.
    availability_zone string
    Availability zone where the snapshot is located.
    disk_id string
    The ID of the cloud disk which the snapshot is created from.
    name_regex string
    output_file string
    id String
    The ID of the snapshot.
    ids List<String>
    snapshots List<GetDiskSnapshotsSnapshot>
    It is a nested type which documented below.
    totalCount Double
    Total number of snapshots that satisfy the condition.
    availabilityZone String
    Availability zone where the snapshot is located.
    diskId String
    The ID of the cloud disk which the snapshot is created from.
    nameRegex String
    outputFile String
    id string
    The ID of the snapshot.
    ids string[]
    snapshots GetDiskSnapshotsSnapshot[]
    It is a nested type which documented below.
    totalCount number
    Total number of snapshots that satisfy the condition.
    availabilityZone string
    Availability zone where the snapshot is located.
    diskId string
    The ID of the cloud disk which the snapshot is created from.
    nameRegex string
    outputFile string
    id str
    The ID of the snapshot.
    ids Sequence[str]
    snapshots Sequence[GetDiskSnapshotsSnapshot]
    It is a nested type which documented below.
    total_count float
    Total number of snapshots that satisfy the condition.
    availability_zone str
    Availability zone where the snapshot is located.
    disk_id str
    The ID of the cloud disk which the snapshot is created from.
    name_regex str
    output_file str
    id String
    The ID of the snapshot.
    ids List<String>
    snapshots List<Property Map>
    It is a nested type which documented below.
    totalCount Number
    Total number of snapshots that satisfy the condition.
    availabilityZone String
    Availability zone where the snapshot is located.
    diskId String
    The ID of the cloud disk which the snapshot is created from.
    nameRegex String
    outputFile String

    Supporting Types

    GetDiskSnapshotsSnapshot

    AvailabilityZone string
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    Comment string
    The description of the snapshot.
    CreateTime string
    The time of creation of the snapshot, formatted in RFC3339 time string.
    DiskId string
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    DiskType string
    The type of the source disk. Possible values are: data_disk as cloud disk, ssd_data_disk as ssd cloud disk, rssd_data_disk as RDMA-SSD cloud disk, system_disk as cloud system disk, ssd_system_disk as ssd cloud system disk.
    Id string
    The ID of the snapshot.
    IsDiskAvailable bool
    Whether the source disk of the snapshot is available.
    Name string
    The name of the snapshot.
    Size double
    The size of the snapshot in GB.
    SourceDiskName string
    The name of the cloud disk which the snapshot is created from.
    Status string
    The status of the snapshot. Possible values are: Normal, Failed, Creating.
    AvailabilityZone string
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    Comment string
    The description of the snapshot.
    CreateTime string
    The time of creation of the snapshot, formatted in RFC3339 time string.
    DiskId string
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    DiskType string
    The type of the source disk. Possible values are: data_disk as cloud disk, ssd_data_disk as ssd cloud disk, rssd_data_disk as RDMA-SSD cloud disk, system_disk as cloud system disk, ssd_system_disk as ssd cloud system disk.
    Id string
    The ID of the snapshot.
    IsDiskAvailable bool
    Whether the source disk of the snapshot is available.
    Name string
    The name of the snapshot.
    Size float64
    The size of the snapshot in GB.
    SourceDiskName string
    The name of the cloud disk which the snapshot is created from.
    Status string
    The status of the snapshot. Possible values are: Normal, Failed, Creating.
    availability_zone string
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    comment string
    The description of the snapshot.
    create_time string
    The time of creation of the snapshot, formatted in RFC3339 time string.
    disk_id string
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    disk_type string
    The type of the source disk. Possible values are: data_disk as cloud disk, ssd_data_disk as ssd cloud disk, rssd_data_disk as RDMA-SSD cloud disk, system_disk as cloud system disk, ssd_system_disk as ssd cloud system disk.
    id string
    The ID of the snapshot.
    is_disk_available bool
    Whether the source disk of the snapshot is available.
    name string
    The name of the snapshot.
    size number
    The size of the snapshot in GB.
    source_disk_name string
    The name of the cloud disk which the snapshot is created from.
    status string
    The status of the snapshot. Possible values are: Normal, Failed, Creating.
    availabilityZone String
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    comment String
    The description of the snapshot.
    createTime String
    The time of creation of the snapshot, formatted in RFC3339 time string.
    diskId String
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    diskType String
    The type of the source disk. Possible values are: data_disk as cloud disk, ssd_data_disk as ssd cloud disk, rssd_data_disk as RDMA-SSD cloud disk, system_disk as cloud system disk, ssd_system_disk as ssd cloud system disk.
    id String
    The ID of the snapshot.
    isDiskAvailable Boolean
    Whether the source disk of the snapshot is available.
    name String
    The name of the snapshot.
    size Double
    The size of the snapshot in GB.
    sourceDiskName String
    The name of the cloud disk which the snapshot is created from.
    status String
    The status of the snapshot. Possible values are: Normal, Failed, Creating.
    availabilityZone string
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    comment string
    The description of the snapshot.
    createTime string
    The time of creation of the snapshot, formatted in RFC3339 time string.
    diskId string
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    diskType string
    The type of the source disk. Possible values are: data_disk as cloud disk, ssd_data_disk as ssd cloud disk, rssd_data_disk as RDMA-SSD cloud disk, system_disk as cloud system disk, ssd_system_disk as ssd cloud system disk.
    id string
    The ID of the snapshot.
    isDiskAvailable boolean
    Whether the source disk of the snapshot is available.
    name string
    The name of the snapshot.
    size number
    The size of the snapshot in GB.
    sourceDiskName string
    The name of the cloud disk which the snapshot is created from.
    status string
    The status of the snapshot. Possible values are: Normal, Failed, Creating.
    availability_zone str
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    comment str
    The description of the snapshot.
    create_time str
    The time of creation of the snapshot, formatted in RFC3339 time string.
    disk_id str
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    disk_type str
    The type of the source disk. Possible values are: data_disk as cloud disk, ssd_data_disk as ssd cloud disk, rssd_data_disk as RDMA-SSD cloud disk, system_disk as cloud system disk, ssd_system_disk as ssd cloud system disk.
    id str
    The ID of the snapshot.
    is_disk_available bool
    Whether the source disk of the snapshot is available.
    name str
    The name of the snapshot.
    size float
    The size of the snapshot in GB.
    source_disk_name str
    The name of the cloud disk which the snapshot is created from.
    status str
    The status of the snapshot. Possible values are: Normal, Failed, Creating.
    availabilityZone String
    Availability zone where the snapshots are located. Such as: "cn-bj2-02". You may refer to list of availability zone. It is required when disk_id is set.
    comment String
    The description of the snapshot.
    createTime String
    The time of creation of the snapshot, formatted in RFC3339 time string.
    diskId String
    The ID of the cloud disk which the snapshots are created from. The availability_zone must be set at the same time.
    diskType String
    The type of the source disk. Possible values are: data_disk as cloud disk, ssd_data_disk as ssd cloud disk, rssd_data_disk as RDMA-SSD cloud disk, system_disk as cloud system disk, ssd_system_disk as ssd cloud system disk.
    id String
    The ID of the snapshot.
    isDiskAvailable Boolean
    Whether the source disk of the snapshot is available.
    name String
    The name of the snapshot.
    size Number
    The size of the snapshot in GB.
    sourceDiskName String
    The name of the cloud disk which the snapshot is created from.
    status String
    The status of the snapshot. Possible values are: Normal, Failed, Creating.

    Package Details

    Repository
    ucloud ucloud/terraform-provider-ucloud
    License
    Notes
    This Pulumi package is based on the ucloud Terraform Provider.
    Viewing docs for ucloud 1.42.0
    published on Friday, Sep 11, 2026 by ucloud

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial