Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

Alibaba Cloud

v3.8.0 published on Monday, Oct 4, 2021 by Pulumi

getInstances

The alicloud.gpdb.getInstances data source provides a collection of AnalyticDB for PostgreSQL instances available in Alicloud account. Filters support regular expression for the instance name or availability_zone.

NOTE: Available in 1.47.0+

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var gpdb = Output.Create(AliCloud.Gpdb.GetInstances.InvokeAsync(new AliCloud.Gpdb.GetInstancesArgs
        {
            AvailabilityZone = "cn-beijing-c",
            NameRegex = "gp-.+\\d+",
            OutputFile = "instances.txt",
        }));
        this.InstanceId = gpdb.Apply(gpdb => gpdb.Instances[0].Id);
    }

    [Output("instanceId")]
    public Output<string> InstanceId { get; set; }
}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := "cn-beijing-c"
		opt1 := "gp-.+\\d+"
		opt2 := "instances.txt"
		gpdb, err := gpdb.GetInstances(ctx, &gpdb.GetInstancesArgs{
			AvailabilityZone: &opt0,
			NameRegex:        &opt1,
			OutputFile:       &opt2,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("instanceId", gpdb.Instances[0].Id)
		return nil
	})
}
import pulumi
import pulumi_alicloud as alicloud

gpdb = alicloud.gpdb.get_instances(availability_zone="cn-beijing-c",
    name_regex="gp-.+\\d+",
    output_file="instances.txt")
pulumi.export("instanceId", gpdb.instances[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const gpdb = pulumi.output(alicloud.gpdb.getInstances({
    availabilityZone: "cn-beijing-c",
    nameRegex: "gp-.+\\d+",
    outputFile: "instances.txt",
}, { async: true }));

export const instanceId = gpdb.instances[0].id;

Using getInstances

function getInstances(args: GetInstancesArgs, opts?: InvokeOptions): Promise<GetInstancesResult>
def get_instances(availability_zone: Optional[str] = None,
                  ids: Optional[Sequence[str]] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  tags: Optional[Mapping[str, Any]] = None,
                  vswitch_id: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetInstancesResult
func GetInstances(ctx *Context, args *GetInstancesArgs, opts ...InvokeOption) (*GetInstancesResult, error)

Note: This function is named GetInstances in the Go SDK.

public static class GetInstances {
    public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

AvailabilityZone string
Instance availability zone.
Ids List<string>
A list of instance IDs.
NameRegex string
A regex string to apply to the instance name.
OutputFile string
Tags Dictionary<string, object>
A mapping of tags to assign to the resource.
VswitchId string
Used to retrieve instances belong to specified vswitch resources.
AvailabilityZone string
Instance availability zone.
Ids []string
A list of instance IDs.
NameRegex string
A regex string to apply to the instance name.
OutputFile string
Tags map[string]interface{}
A mapping of tags to assign to the resource.
VswitchId string
Used to retrieve instances belong to specified vswitch resources.
availabilityZone string
Instance availability zone.
ids string[]
A list of instance IDs.
nameRegex string
A regex string to apply to the instance name.
outputFile string
tags {[key: string]: any}
A mapping of tags to assign to the resource.
vswitchId string
Used to retrieve instances belong to specified vswitch resources.
availability_zone str
Instance availability zone.
ids Sequence[str]
A list of instance IDs.
name_regex str
A regex string to apply to the instance name.
output_file str
tags Mapping[str, Any]
A mapping of tags to assign to the resource.
vswitch_id str
Used to retrieve instances belong to specified vswitch resources.

getInstances Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
The ids list of AnalyticDB for PostgreSQL instances.
Instances List<Pulumi.AliCloud.Gpdb.Outputs.GetInstancesInstance>
A list of AnalyticDB for PostgreSQL instances. Its every element contains the following attributes:
Names List<string>
The names list of AnalyticDB for PostgreSQL instance.
AvailabilityZone string
Instance availability zone.
NameRegex string
OutputFile string
Tags Dictionary<string, object>
VswitchId string
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
The ids list of AnalyticDB for PostgreSQL instances.
Instances []GetInstancesInstance
A list of AnalyticDB for PostgreSQL instances. Its every element contains the following attributes:
Names []string
The names list of AnalyticDB for PostgreSQL instance.
AvailabilityZone string
Instance availability zone.
NameRegex string
OutputFile string
Tags map[string]interface{}
VswitchId string
id string
The provider-assigned unique ID for this managed resource.
ids string[]
The ids list of AnalyticDB for PostgreSQL instances.
instances GetInstancesInstance[]
A list of AnalyticDB for PostgreSQL instances. Its every element contains the following attributes:
names string[]
The names list of AnalyticDB for PostgreSQL instance.
availabilityZone string
Instance availability zone.
nameRegex string
outputFile string
tags {[key: string]: any}
vswitchId string
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
The ids list of AnalyticDB for PostgreSQL instances.
instances Sequence[GetInstancesInstance]
A list of AnalyticDB for PostgreSQL instances. Its every element contains the following attributes:
names Sequence[str]
The names list of AnalyticDB for PostgreSQL instance.
availability_zone str
Instance availability zone.
name_regex str
output_file str
tags Mapping[str, Any]
vswitch_id str

Supporting Types

GetInstancesInstance

AvailabilityZone string
Instance availability zone.
ChargeType string
Billing method. Value options are PostPaid for Pay-As-You-Go and PrePaid for yearly or monthly subscription.
CreationTime string
The time when you create an instance. The format is YYYY-MM-DDThh:mm:ssZ, such as 2011-05-30T12:11:4Z.
Description string
The description of an instance.
Engine string
Database engine type. Supported option is gpdb.
EngineVersion string
Database engine version.
Id string
The instance id.
InstanceClass string
The group type.
InstanceGroupCount string
The number of groups.
InstanceNetworkType string
RegionId string
Region ID the instance belongs to.
Status string
Status of the instance.
AvailabilityZone string
Instance availability zone.
ChargeType string
Billing method. Value options are PostPaid for Pay-As-You-Go and PrePaid for yearly or monthly subscription.
CreationTime string
The time when you create an instance. The format is YYYY-MM-DDThh:mm:ssZ, such as 2011-05-30T12:11:4Z.
Description string
The description of an instance.
Engine string
Database engine type. Supported option is gpdb.
EngineVersion string
Database engine version.
Id string
The instance id.
InstanceClass string
The group type.
InstanceGroupCount string
The number of groups.
InstanceNetworkType string
RegionId string
Region ID the instance belongs to.
Status string
Status of the instance.
availabilityZone string
Instance availability zone.
chargeType string
Billing method. Value options are PostPaid for Pay-As-You-Go and PrePaid for yearly or monthly subscription.
creationTime string
The time when you create an instance. The format is YYYY-MM-DDThh:mm:ssZ, such as 2011-05-30T12:11:4Z.
description string
The description of an instance.
engine string
Database engine type. Supported option is gpdb.
engineVersion string
Database engine version.
id string
The instance id.
instanceClass string
The group type.
instanceGroupCount string
The number of groups.
instanceNetworkType string
regionId string
Region ID the instance belongs to.
status string
Status of the instance.
availability_zone str
Instance availability zone.
charge_type str
Billing method. Value options are PostPaid for Pay-As-You-Go and PrePaid for yearly or monthly subscription.
creation_time str
The time when you create an instance. The format is YYYY-MM-DDThh:mm:ssZ, such as 2011-05-30T12:11:4Z.
description str
The description of an instance.
engine str
Database engine type. Supported option is gpdb.
engine_version str
Database engine version.
id str
The instance id.
instance_class str
The group type.
instance_group_count str
The number of groups.
instance_network_type str
region_id str
Region ID the instance belongs to.
status str
Status of the instance.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.