1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. drds
  5. getInstances
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

alicloud.drds.getInstances

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 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);
    
    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)
    
    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
    	})
    }
    
    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),
        };
    });
    
    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()));
        }
    }
    
    variables:
      drdsInstancesDs:
        fn::invoke:
          Function: alicloud:drds:getInstances
          Arguments:
            nameRegex: drds-\d+
            ids:
              - drdsabc123456
    outputs:
      firstDbInstanceId: ${drdsInstancesDs.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(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]
    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)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:drds/getInstances:getInstances
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DescriptionRegex string
    A regex string to filter results by instance description.
    Ids 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 []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 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 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 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 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 string
    (Available in 1.196.0+) The connection string of the DRDS instance.
    CreateTime int
    Creation time of the instance.
    Description string
    The DRDS instance description.
    Id string
    The ID of the DRDS instance.
    NetworkType string
    Classic for public classic network or VPC for private network.
    Port string
    (Available in 1.196.0+) The connection port of the DRDS instance.
    Status string
    Status of the instance.
    Type string
    The DRDS Instance type.
    Version int
    The DRDS Instance version.
    ZoneId string
    Zone ID the instance belongs to.
    ConnectionString string
    (Available in 1.196.0+) The connection string of the DRDS instance.
    CreateTime int
    Creation time of the instance.
    Description string
    The DRDS instance description.
    Id string
    The ID of the DRDS instance.
    NetworkType string
    Classic for public classic network or VPC for private network.
    Port string
    (Available in 1.196.0+) The connection port of the DRDS instance.
    Status string
    Status of the instance.
    Type string
    The DRDS Instance type.
    Version int
    The DRDS Instance version.
    ZoneId string
    Zone ID the instance belongs to.
    connectionString String
    (Available in 1.196.0+) The connection string of the DRDS instance.
    createTime Integer
    Creation time of the instance.
    description String
    The DRDS instance description.
    id String
    The ID of the DRDS instance.
    networkType String
    Classic for public classic network or VPC for private network.
    port String
    (Available in 1.196.0+) The connection port of the DRDS instance.
    status String
    Status of the instance.
    type String
    The DRDS Instance type.
    version Integer
    The DRDS Instance version.
    zoneId String
    Zone ID the instance belongs to.
    connectionString string
    (Available in 1.196.0+) The connection string of the DRDS instance.
    createTime number
    Creation time of the instance.
    description string
    The DRDS instance description.
    id string
    The ID of the DRDS instance.
    networkType string
    Classic for public classic network or VPC for private network.
    port string
    (Available in 1.196.0+) The connection port of the DRDS instance.
    status string
    Status of the instance.
    type string
    The DRDS Instance type.
    version number
    The DRDS Instance version.
    zoneId string
    Zone ID the instance belongs to.
    connection_string str
    (Available in 1.196.0+) The connection string of the DRDS instance.
    create_time int
    Creation time of the instance.
    description str
    The DRDS instance description.
    id str
    The ID of the DRDS instance.
    network_type str
    Classic for public classic network or VPC for private network.
    port str
    (Available in 1.196.0+) The connection port of the DRDS instance.
    status str
    Status of the instance.
    type str
    The DRDS Instance type.
    version int
    The DRDS Instance version.
    zone_id str
    Zone ID the instance belongs to.
    connectionString String
    (Available in 1.196.0+) The connection string of the DRDS instance.
    createTime Number
    Creation time of the instance.
    description String
    The DRDS instance description.
    id String
    The ID of the DRDS instance.
    networkType String
    Classic for public classic network or VPC for private network.
    port String
    (Available in 1.196.0+) The connection port of the DRDS instance.
    status String
    Status of the instance.
    type String
    The DRDS Instance type.
    version Number
    The DRDS Instance version.
    zoneId 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.
    alicloud logo
    Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi