Viewing docs for ucloud 1.39.3
published on Wednesday, Mar 11, 2026 by ucloud
published on Wednesday, Mar 11, 2026 by ucloud
Viewing docs for ucloud 1.39.3
published on Wednesday, Mar 11, 2026 by ucloud
published on Wednesday, Mar 11, 2026 by ucloud
This data source providers a list of UHost instance resources according to their availability zone, instance ID and tag.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ucloud from "@pulumi/ucloud";
const example = ucloud.getInstances({
availabilityZone: "cn-bj2-02",
});
export const first = example.then(example => example.instances?.[0]?.id);
import pulumi
import pulumi_ucloud as ucloud
example = ucloud.get_instances(availability_zone="cn-bj2-02")
pulumi.export("first", example.instances[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.GetInstances(ctx, &ucloud.GetInstancesArgs{
AvailabilityZone: pulumi.StringRef("cn-bj2-02"),
}, nil)
if err != nil {
return err
}
ctx.Export("first", example.Instances[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ucloud = Pulumi.Ucloud;
return await Deployment.RunAsync(() =>
{
var example = Ucloud.GetInstances.Invoke(new()
{
AvailabilityZone = "cn-bj2-02",
});
return new Dictionary<string, object?>
{
["first"] = example.Apply(getInstancesResult => getInstancesResult.Instances[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.GetInstancesArgs;
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.getInstances(GetInstancesArgs.builder()
.availabilityZone("cn-bj2-02")
.build());
ctx.export("first", example.instances()[0].id());
}
}
variables:
example:
fn::invoke:
function: ucloud:getInstances
arguments:
availabilityZone: cn-bj2-02
outputs:
first: ${example.instances[0].id}
Using getInstances
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 getInstances(args: GetInstancesArgs, opts?: InvokeOptions): Promise<GetInstancesResult>
function getInstancesOutput(args: GetInstancesOutputArgs, opts?: InvokeOptions): Output<GetInstancesResult>def get_instances(availability_zone: Optional[str] = None,
id: Optional[str] = None,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
tag: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetInstancesResult
def get_instances_output(availability_zone: 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,
tag: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetInstancesResult]func GetInstances(ctx *Context, args *GetInstancesArgs, opts ...InvokeOption) (*GetInstancesResult, error)
func GetInstancesOutput(ctx *Context, args *GetInstancesOutputArgs, opts ...InvokeOption) GetInstancesResultOutput> Note: This function is named GetInstances in the Go SDK.
public static class GetInstances
{
public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs args, InvokeOptions? opts = null)
public static Output<GetInstancesResult> Invoke(GetInstancesInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
public static Output<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
fn::invoke:
function: ucloud:index/getInstances:getInstances
arguments:
# arguments dictionaryThe following arguments are supported:
- Availability
Zone string - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- Id string
- The ID of disk.
- Ids List<string>
- A list of instance IDs, all the instances belongs to the defined region will be retrieved if this argument is
[]. - Name
Regex string - A regex string to filter resulting instances by name.
- Output
File string - File name where to save data source results (after running
pulumi preview). - Tag string
- A tag assigned to instance.
- Availability
Zone string - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- Id string
- The ID of disk.
- Ids []string
- A list of instance IDs, all the instances belongs to the defined region will be retrieved if this argument is
[]. - Name
Regex string - A regex string to filter resulting instances by name.
- Output
File string - File name where to save data source results (after running
pulumi preview). - Tag string
- A tag assigned to instance.
- availability
Zone String - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- id String
- The ID of disk.
- ids List<String>
- A list of instance IDs, all the instances belongs to the defined region will be retrieved if this argument is
[]. - name
Regex String - A regex string to filter resulting instances by name.
- output
File String - File name where to save data source results (after running
pulumi preview). - tag String
- A tag assigned to instance.
- availability
Zone string - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- id string
- The ID of disk.
- ids string[]
- A list of instance IDs, all the instances belongs to the defined region will be retrieved if this argument is
[]. - name
Regex string - A regex string to filter resulting instances by name.
- output
File string - File name where to save data source results (after running
pulumi preview). - tag string
- A tag assigned to instance.
- availability_
zone str - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- id str
- The ID of disk.
- ids Sequence[str]
- A list of instance IDs, all the instances belongs to the defined region will be retrieved if this argument is
[]. - name_
regex str - A regex string to filter resulting instances by name.
- output_
file str - File name where to save data source results (after running
pulumi preview). - tag str
- A tag assigned to instance.
- availability
Zone String - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- id String
- The ID of disk.
- ids List<String>
- A list of instance IDs, all the instances belongs to the defined region will be retrieved if this argument is
[]. - name
Regex String - A regex string to filter resulting instances by name.
- output
File String - File name where to save data source results (after running
pulumi preview). - tag String
- A tag assigned to instance.
getInstances Result
The following output properties are available:
- Id string
- The ID of disk.
- Ids List<string>
- Instances
List<Get
Instances Instance> - It is a nested type. instances documented below.
- Total
Count double - Total number of instances that satisfy the condition.
- Availability
Zone string - Availability zone where instances are located.
- Name
Regex string - Output
File string - Tag string
- A tag assigned to the instance.
- Id string
- The ID of disk.
- Ids []string
- Instances
[]Get
Instances Instance - It is a nested type. instances documented below.
- Total
Count float64 - Total number of instances that satisfy the condition.
- Availability
Zone string - Availability zone where instances are located.
- Name
Regex string - Output
File string - Tag string
- A tag assigned to the instance.
- id String
- The ID of disk.
- ids List<String>
- instances
List<Get
Instances Instance> - It is a nested type. instances documented below.
- total
Count Double - Total number of instances that satisfy the condition.
- availability
Zone String - Availability zone where instances are located.
- name
Regex String - output
File String - tag String
- A tag assigned to the instance.
- id string
- The ID of disk.
- ids string[]
- instances
Get
Instances Instance[] - It is a nested type. instances documented below.
- total
Count number - Total number of instances that satisfy the condition.
- availability
Zone string - Availability zone where instances are located.
- name
Regex string - output
File string - tag string
- A tag assigned to the instance.
- id str
- The ID of disk.
- ids Sequence[str]
- instances
Sequence[Get
Instances Instance] - It is a nested type. instances documented below.
- total_
count float - Total number of instances that satisfy the condition.
- availability_
zone str - Availability zone where instances are located.
- name_
regex str - output_
file str - tag str
- A tag assigned to the instance.
- id String
- The ID of disk.
- ids List<String>
- instances List<Property Map>
- It is a nested type. instances documented below.
- total
Count Number - Total number of instances that satisfy the condition.
- availability
Zone String - Availability zone where instances are located.
- name
Regex String - output
File String - tag String
- A tag assigned to the instance.
Supporting Types
GetInstancesInstance
- Auto
Renew bool - Whether to renew an instance automatically or not.
- Availability
Zone string - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- Charge
Type string - The charge type of instance, possible values are:
year,monthanddynamicas pay by hour. - Cpu double
- The number of cores of virtual CPU, measureed in core.
- Create
Time string - The time of creation for instance, formatted in RFC3339 time string.
- Disk
Sets List<GetInstances Instance Disk Set> - It is a nested type which documented below.
- Expire
Time string - The expiration time for instance, formatted in RFC3339 time string.
- Id string
- The ID of disk.
- Instance
Type string - The type of instance.
- Ip
Sets List<GetInstances Instance Ip Set> - It is a nested type which documented below.
- Memory double
- The size of memory, measured in MB (Megabyte).
- Name string
- The name of the instance.
- Private
Ip string - The private IP address assigned to the instance.
- Remark string
- The remarks of instance.
- Status string
- Instance current status. Possible values are
Initializing,Starting,Running,Stopping,Stopped,Install FailandRebooting. - Subnet
Id string - The ID of subnet linked to the instance.
- Tag string
- A tag assigned to instance.
- Vpc
Id string - The ID of VPC linked to the instance.
- Auto
Renew bool - Whether to renew an instance automatically or not.
- Availability
Zone string - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- Charge
Type string - The charge type of instance, possible values are:
year,monthanddynamicas pay by hour. - Cpu float64
- The number of cores of virtual CPU, measureed in core.
- Create
Time string - The time of creation for instance, formatted in RFC3339 time string.
- Disk
Sets []GetInstances Instance Disk Set - It is a nested type which documented below.
- Expire
Time string - The expiration time for instance, formatted in RFC3339 time string.
- Id string
- The ID of disk.
- Instance
Type string - The type of instance.
- Ip
Sets []GetInstances Instance Ip Set - It is a nested type which documented below.
- Memory float64
- The size of memory, measured in MB (Megabyte).
- Name string
- The name of the instance.
- Private
Ip string - The private IP address assigned to the instance.
- Remark string
- The remarks of instance.
- Status string
- Instance current status. Possible values are
Initializing,Starting,Running,Stopping,Stopped,Install FailandRebooting. - Subnet
Id string - The ID of subnet linked to the instance.
- Tag string
- A tag assigned to instance.
- Vpc
Id string - The ID of VPC linked to the instance.
- auto
Renew Boolean - Whether to renew an instance automatically or not.
- availability
Zone String - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- charge
Type String - The charge type of instance, possible values are:
year,monthanddynamicas pay by hour. - cpu Double
- The number of cores of virtual CPU, measureed in core.
- create
Time String - The time of creation for instance, formatted in RFC3339 time string.
- disk
Sets List<GetInstances Instance Disk Set> - It is a nested type which documented below.
- expire
Time String - The expiration time for instance, formatted in RFC3339 time string.
- id String
- The ID of disk.
- instance
Type String - The type of instance.
- ip
Sets List<GetInstances Instance Ip Set> - It is a nested type which documented below.
- memory Double
- The size of memory, measured in MB (Megabyte).
- name String
- The name of the instance.
- private
Ip String - The private IP address assigned to the instance.
- remark String
- The remarks of instance.
- status String
- Instance current status. Possible values are
Initializing,Starting,Running,Stopping,Stopped,Install FailandRebooting. - subnet
Id String - The ID of subnet linked to the instance.
- tag String
- A tag assigned to instance.
- vpc
Id String - The ID of VPC linked to the instance.
- auto
Renew boolean - Whether to renew an instance automatically or not.
- availability
Zone string - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- charge
Type string - The charge type of instance, possible values are:
year,monthanddynamicas pay by hour. - cpu number
- The number of cores of virtual CPU, measureed in core.
- create
Time string - The time of creation for instance, formatted in RFC3339 time string.
- disk
Sets GetInstances Instance Disk Set[] - It is a nested type which documented below.
- expire
Time string - The expiration time for instance, formatted in RFC3339 time string.
- id string
- The ID of disk.
- instance
Type string - The type of instance.
- ip
Sets GetInstances Instance Ip Set[] - It is a nested type which documented below.
- memory number
- The size of memory, measured in MB (Megabyte).
- name string
- The name of the instance.
- private
Ip string - The private IP address assigned to the instance.
- remark string
- The remarks of instance.
- status string
- Instance current status. Possible values are
Initializing,Starting,Running,Stopping,Stopped,Install FailandRebooting. - subnet
Id string - The ID of subnet linked to the instance.
- tag string
- A tag assigned to instance.
- vpc
Id string - The ID of VPC linked to the instance.
- auto_
renew bool - Whether to renew an instance automatically or not.
- availability_
zone str - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- charge_
type str - The charge type of instance, possible values are:
year,monthanddynamicas pay by hour. - cpu float
- The number of cores of virtual CPU, measureed in core.
- create_
time str - The time of creation for instance, formatted in RFC3339 time string.
- disk_
sets Sequence[GetInstances Instance Disk Set] - It is a nested type which documented below.
- expire_
time str - The expiration time for instance, formatted in RFC3339 time string.
- id str
- The ID of disk.
- instance_
type str - The type of instance.
- ip_
sets Sequence[GetInstances Instance Ip Set] - It is a nested type which documented below.
- memory float
- The size of memory, measured in MB (Megabyte).
- name str
- The name of the instance.
- private_
ip str - The private IP address assigned to the instance.
- remark str
- The remarks of instance.
- status str
- Instance current status. Possible values are
Initializing,Starting,Running,Stopping,Stopped,Install FailandRebooting. - subnet_
id str - The ID of subnet linked to the instance.
- tag str
- A tag assigned to instance.
- vpc_
id str - The ID of VPC linked to the instance.
- auto
Renew Boolean - Whether to renew an instance automatically or not.
- availability
Zone String - Availability zone where instances are located. Such as: "cn-bj2-02". You may refer to list of availability zone
- charge
Type String - The charge type of instance, possible values are:
year,monthanddynamicas pay by hour. - cpu Number
- The number of cores of virtual CPU, measureed in core.
- create
Time String - The time of creation for instance, formatted in RFC3339 time string.
- disk
Sets List<Property Map> - It is a nested type which documented below.
- expire
Time String - The expiration time for instance, formatted in RFC3339 time string.
- id String
- The ID of disk.
- instance
Type String - The type of instance.
- ip
Sets List<Property Map> - It is a nested type which documented below.
- memory Number
- The size of memory, measured in MB (Megabyte).
- name String
- The name of the instance.
- private
Ip String - The private IP address assigned to the instance.
- remark String
- The remarks of instance.
- status String
- Instance current status. Possible values are
Initializing,Starting,Running,Stopping,Stopped,Install FailandRebooting. - subnet
Id String - The ID of subnet linked to the instance.
- tag String
- A tag assigned to instance.
- vpc
Id String - The ID of VPC linked to the instance.
GetInstancesInstanceDiskSet
GetInstancesInstanceIpSet
- Internet
Type string - Type of Elastic IP routes.
- Ip string
- Elastic IP address.
- Internet
Type string - Type of Elastic IP routes.
- Ip string
- Elastic IP address.
- internet
Type String - Type of Elastic IP routes.
- ip String
- Elastic IP address.
- internet
Type string - Type of Elastic IP routes.
- ip string
- Elastic IP address.
- internet_
type str - Type of Elastic IP routes.
- ip str
- Elastic IP address.
- internet
Type String - Type of Elastic IP routes.
- ip String
- Elastic IP address.
Package Details
- Repository
- ucloud ucloud/terraform-provider-ucloud
- License
- Notes
- This Pulumi package is based on the
ucloudTerraform Provider.
Viewing docs for ucloud 1.39.3
published on Wednesday, Mar 11, 2026 by ucloud
published on Wednesday, Mar 11, 2026 by ucloud
