1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. drds
  5. getInstances
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.drds.getInstances

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

The alicloud.drds.Instance data source provides a collection of DRDS instances available in Alibaba Cloud account. Filters support regular expression for the instance name, searches by tags, and other filters which are listed below.

NOTE: Available in 1.35.0+.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const drdsInstancesDs = alicloud.drds.getInstances({
    nameRegex: "drds-\\d+",
    ids: ["drdsabc123456"],
});
export const firstDbInstanceId = drdsInstancesDs.then(drdsInstancesDs => drdsInstancesDs.instances?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

drds_instances_ds = alicloud.drds.get_instances(name_regex="drds-\\d+",
    ids=["drdsabc123456"])
pulumi.export("firstDbInstanceId", drds_instances_ds.instances[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/drds"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		drdsInstancesDs, err := drds.GetInstances(ctx, &drds.GetInstancesArgs{
			NameRegex: pulumi.StringRef("drds-\\d+"),
			Ids: []string{
				"drdsabc123456",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstDbInstanceId", drdsInstancesDs.Instances[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var drdsInstancesDs = AliCloud.Drds.GetInstances.Invoke(new()
    {
        NameRegex = "drds-\\d+",
        Ids = new[]
        {
            "drdsabc123456",
        },
    });

    return new Dictionary<string, object?>
    {
        ["firstDbInstanceId"] = drdsInstancesDs.Apply(getInstancesResult => getInstancesResult.Instances[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.drds.DrdsFunctions;
import com.pulumi.alicloud.drds.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 drdsInstancesDs = DrdsFunctions.getInstances(GetInstancesArgs.builder()
            .nameRegex("drds-\\d+")
            .ids("drdsabc123456")
            .build());

        ctx.export("firstDbInstanceId", drdsInstancesDs.applyValue(getInstancesResult -> getInstancesResult.instances()[0].id()));
    }
}
Copy
variables:
  drdsInstancesDs:
    fn::invoke:
      function: alicloud:drds:getInstances
      arguments:
        nameRegex: drds-\d+
        ids:
          - drdsabc123456
outputs:
  firstDbInstanceId: ${drdsInstancesDs.instances[0].id}
Copy

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>
Copy
def get_instances(description_regex: Optional[str] = None,
                  ids: Optional[Sequence[str]] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetInstancesResult
def get_instances_output(description_regex: 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[GetInstancesResult]
Copy
func GetInstances(ctx *Context, args *GetInstancesArgs, opts ...InvokeOption) (*GetInstancesResult, error)
func GetInstancesOutput(ctx *Context, args *GetInstancesOutputArgs, opts ...InvokeOption) GetInstancesResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
public static Output<GetInstancesResult> getInstances(GetInstancesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:drds/getInstances:getInstances
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

DescriptionRegex string
A regex string to filter results by instance description.
Ids Changes to this property will trigger replacement. List<string>
A list of DRDS instance IDs.
NameRegex string
A regex string to filter results by instance description. It is deprecated since v1.91.0 and will be removed in a future release, please use 'description_regex' instead.

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

OutputFile string
DescriptionRegex string
A regex string to filter results by instance description.
Ids Changes to this property will trigger replacement. []string
A list of DRDS instance IDs.
NameRegex string
A regex string to filter results by instance description. It is deprecated since v1.91.0 and will be removed in a future release, please use 'description_regex' instead.

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

OutputFile string
descriptionRegex String
A regex string to filter results by instance description.
ids Changes to this property will trigger replacement. List<String>
A list of DRDS instance IDs.
nameRegex String
A regex string to filter results by instance description. It is deprecated since v1.91.0 and will be removed in a future release, please use 'description_regex' instead.

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

outputFile String
descriptionRegex string
A regex string to filter results by instance description.
ids Changes to this property will trigger replacement. string[]
A list of DRDS instance IDs.
nameRegex string
A regex string to filter results by instance description. It is deprecated since v1.91.0 and will be removed in a future release, please use 'description_regex' instead.

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

outputFile string
description_regex str
A regex string to filter results by instance description.
ids Changes to this property will trigger replacement. Sequence[str]
A list of DRDS instance IDs.
name_regex str
A regex string to filter results by instance description. It is deprecated since v1.91.0 and will be removed in a future release, please use 'description_regex' instead.

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

output_file str
descriptionRegex String
A regex string to filter results by instance description.
ids Changes to this property will trigger replacement. List<String>
A list of DRDS instance IDs.
nameRegex String
A regex string to filter results by instance description. It is deprecated since v1.91.0 and will be removed in a future release, please use 'description_regex' instead.

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

outputFile String

getInstances Result

The following output properties are available:

Descriptions List<string>
A list of DRDS descriptions.
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
A list of DRDS instance IDs.
Instances List<Pulumi.AliCloud.Drds.Outputs.GetInstancesInstance>
A list of DRDS instances.
DescriptionRegex string
NameRegex string

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

OutputFile string
Descriptions []string
A list of DRDS descriptions.
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
A list of DRDS instance IDs.
Instances []GetInstancesInstance
A list of DRDS instances.
DescriptionRegex string
NameRegex string

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

OutputFile string
descriptions List<String>
A list of DRDS descriptions.
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
A list of DRDS instance IDs.
instances List<GetInstancesInstance>
A list of DRDS instances.
descriptionRegex String
nameRegex String

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

outputFile String
descriptions string[]
A list of DRDS descriptions.
id string
The provider-assigned unique ID for this managed resource.
ids string[]
A list of DRDS instance IDs.
instances GetInstancesInstance[]
A list of DRDS instances.
descriptionRegex string
nameRegex string

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

outputFile string
descriptions Sequence[str]
A list of DRDS descriptions.
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
A list of DRDS instance IDs.
instances Sequence[GetInstancesInstance]
A list of DRDS instances.
description_regex str
name_regex str

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

output_file str
descriptions List<String>
A list of DRDS descriptions.
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
A list of DRDS instance IDs.
instances List<Property Map>
A list of DRDS instances.
descriptionRegex String
nameRegex String

Deprecated: Field 'name_regex' is deprecated and will be removed in a future release. Please use 'description_regex' instead.

outputFile String

Supporting Types

GetInstancesInstance

ConnectionString This property is required. string
(Available in 1.196.0+) The connection string of the DRDS instance.
CreateTime This property is required. int
Creation time of the instance.
Description This property is required. string
The DRDS instance description.
Id This property is required. string
The ID of the DRDS instance.
NetworkType This property is required. string
Classic for public classic network or VPC for private network.
Port This property is required. string
(Available in 1.196.0+) The connection port of the DRDS instance.
Status This property is required. string
Status of the instance.
Type This property is required. string
The DRDS Instance type.
Version This property is required. int
The DRDS Instance version.
ZoneId This property is required. string
Zone ID the instance belongs to.
ConnectionString This property is required. string
(Available in 1.196.0+) The connection string of the DRDS instance.
CreateTime This property is required. int
Creation time of the instance.
Description This property is required. string
The DRDS instance description.
Id This property is required. string
The ID of the DRDS instance.
NetworkType This property is required. string
Classic for public classic network or VPC for private network.
Port This property is required. string
(Available in 1.196.0+) The connection port of the DRDS instance.
Status This property is required. string
Status of the instance.
Type This property is required. string
The DRDS Instance type.
Version This property is required. int
The DRDS Instance version.
ZoneId This property is required. string
Zone ID the instance belongs to.
connectionString This property is required. String
(Available in 1.196.0+) The connection string of the DRDS instance.
createTime This property is required. Integer
Creation time of the instance.
description This property is required. String
The DRDS instance description.
id This property is required. String
The ID of the DRDS instance.
networkType This property is required. String
Classic for public classic network or VPC for private network.
port This property is required. String
(Available in 1.196.0+) The connection port of the DRDS instance.
status This property is required. String
Status of the instance.
type This property is required. String
The DRDS Instance type.
version This property is required. Integer
The DRDS Instance version.
zoneId This property is required. String
Zone ID the instance belongs to.
connectionString This property is required. string
(Available in 1.196.0+) The connection string of the DRDS instance.
createTime This property is required. number
Creation time of the instance.
description This property is required. string
The DRDS instance description.
id This property is required. string
The ID of the DRDS instance.
networkType This property is required. string
Classic for public classic network or VPC for private network.
port This property is required. string
(Available in 1.196.0+) The connection port of the DRDS instance.
status This property is required. string
Status of the instance.
type This property is required. string
The DRDS Instance type.
version This property is required. number
The DRDS Instance version.
zoneId This property is required. string
Zone ID the instance belongs to.
connection_string This property is required. str
(Available in 1.196.0+) The connection string of the DRDS instance.
create_time This property is required. int
Creation time of the instance.
description This property is required. str
The DRDS instance description.
id This property is required. str
The ID of the DRDS instance.
network_type This property is required. str
Classic for public classic network or VPC for private network.
port This property is required. str
(Available in 1.196.0+) The connection port of the DRDS instance.
status This property is required. str
Status of the instance.
type This property is required. str
The DRDS Instance type.
version This property is required. int
The DRDS Instance version.
zone_id This property is required. str
Zone ID the instance belongs to.
connectionString This property is required. String
(Available in 1.196.0+) The connection string of the DRDS instance.
createTime This property is required. Number
Creation time of the instance.
description This property is required. String
The DRDS instance description.
id This property is required. String
The ID of the DRDS instance.
networkType This property is required. String
Classic for public classic network or VPC for private network.
port This property is required. String
(Available in 1.196.0+) The connection port of the DRDS instance.
status This property is required. String
Status of the instance.
type This property is required. String
The DRDS Instance type.
version This property is required. Number
The DRDS Instance version.
zoneId This property is required. String
Zone ID the instance belongs to.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi