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

alicloud.rocketmq.getInstances

Explore with Pulumi AI

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

This data source provides a list of ONS Instances in an Alibaba Cloud account according to the specified filters.

NOTE: Available in 1.52.0+

Example Usage

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

const config = new pulumi.Config();
const name = config.get("name") || "onsInstanceDatasourceName";
const _default = new alicloud.rocketmq.Instance("default", {
    name: name,
    remark: "default_ons_instance_remark",
});
const instancesDs = alicloud.rocketmq.getInstancesOutput({
    ids: [_default.id],
    nameRegex: _default.name,
    outputFile: "instances.txt",
});
export const firstInstanceId = instancesDs.apply(instancesDs => instancesDs.instances?.[0]?.instanceId);
Copy
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "onsInstanceDatasourceName"
default = alicloud.rocketmq.Instance("default",
    name=name,
    remark="default_ons_instance_remark")
instances_ds = alicloud.rocketmq.get_instances_output(ids=[default.id],
    name_regex=default.name,
    output_file="instances.txt")
pulumi.export("firstInstanceId", instances_ds.instances[0].instance_id)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		name := "onsInstanceDatasourceName"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		_default, err := rocketmq.NewInstance(ctx, "default", &rocketmq.InstanceArgs{
			Name:   pulumi.String(name),
			Remark: pulumi.String("default_ons_instance_remark"),
		})
		if err != nil {
			return err
		}
		instancesDs := rocketmq.GetInstancesOutput(ctx, rocketmq.GetInstancesOutputArgs{
			Ids: pulumi.StringArray{
				_default.ID(),
			},
			NameRegex:  _default.Name,
			OutputFile: pulumi.String("instances.txt"),
		}, nil)
		ctx.Export("firstInstanceId", instancesDs.ApplyT(func(instancesDs rocketmq.GetInstancesResult) (*string, error) {
			return &instancesDs.Instances[0].InstanceId, nil
		}).(pulumi.StringPtrOutput))
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "onsInstanceDatasourceName";
    var @default = new AliCloud.RocketMQ.Instance("default", new()
    {
        Name = name,
        Remark = "default_ons_instance_remark",
    });

    var instancesDs = AliCloud.RocketMQ.GetInstances.Invoke(new()
    {
        Ids = new[]
        {
            @default.Id,
        },
        NameRegex = @default.Name,
        OutputFile = "instances.txt",
    });

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

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.rocketmq.Instance;
import com.pulumi.alicloud.rocketmq.InstanceArgs;
import com.pulumi.alicloud.rocketmq.RocketmqFunctions;
import com.pulumi.alicloud.rocketmq.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 config = ctx.config();
        final var name = config.get("name").orElse("onsInstanceDatasourceName");
        var default_ = new Instance("default", InstanceArgs.builder()
            .name(name)
            .remark("default_ons_instance_remark")
            .build());

        final var instancesDs = RocketmqFunctions.getInstances(GetInstancesArgs.builder()
            .ids(default_.id())
            .nameRegex(default_.name())
            .outputFile("instances.txt")
            .build());

        ctx.export("firstInstanceId", instancesDs.applyValue(getInstancesResult -> getInstancesResult).applyValue(instancesDs -> instancesDs.applyValue(getInstancesResult -> getInstancesResult.instances()[0].instanceId())));
    }
}
Copy
configuration:
  name:
    type: string
    default: onsInstanceDatasourceName
resources:
  default:
    type: alicloud:rocketmq:Instance
    properties:
      name: ${name}
      remark: default_ons_instance_remark
variables:
  instancesDs:
    fn::invoke:
      function: alicloud:rocketmq:getInstances
      arguments:
        ids:
          - ${default.id}
        nameRegex: ${default.name}
        outputFile: instances.txt
outputs:
  firstInstanceId: ${instancesDs.instances[0].instanceId}
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(enable_details: Optional[bool] = None,
                  ids: Optional[Sequence[str]] = None,
                  name_regex: Optional[str] = None,
                  output_file: Optional[str] = None,
                  status: Optional[int] = None,
                  tags: Optional[Mapping[str, str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetInstancesResult
def get_instances_output(enable_details: Optional[pulumi.Input[bool]] = None,
                  ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  name_regex: Optional[pulumi.Input[str]] = None,
                  output_file: Optional[pulumi.Input[str]] = None,
                  status: Optional[pulumi.Input[int]] = None,
                  tags: Optional[pulumi.Input[Mapping[str, 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:rocketmq/getInstances:getInstances
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

EnableDetails bool
Default to false. Set it to true can output more details.
Ids Changes to this property will trigger replacement. List<string>
A list of instance IDs to filter results.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by the instance name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. int
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
Tags Dictionary<string, string>
A map of tags assigned to the Ons instance.
EnableDetails bool
Default to false. Set it to true can output more details.
Ids Changes to this property will trigger replacement. []string
A list of instance IDs to filter results.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by the instance name.
OutputFile string
File name where to save data source results (after running pulumi preview).
Status Changes to this property will trigger replacement. int
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
Tags map[string]string
A map of tags assigned to the Ons instance.
enableDetails Boolean
Default to false. Set it to true can output more details.
ids Changes to this property will trigger replacement. List<String>
A list of instance IDs to filter results.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by the instance name.
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. Integer
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
tags Map<String,String>
A map of tags assigned to the Ons instance.
enableDetails boolean
Default to false. Set it to true can output more details.
ids Changes to this property will trigger replacement. string[]
A list of instance IDs to filter results.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by the instance name.
outputFile string
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. number
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
tags {[key: string]: string}
A map of tags assigned to the Ons instance.
enable_details bool
Default to false. Set it to true can output more details.
ids Changes to this property will trigger replacement. Sequence[str]
A list of instance IDs to filter results.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by the instance name.
output_file str
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. int
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
tags Mapping[str, str]
A map of tags assigned to the Ons instance.
enableDetails Boolean
Default to false. Set it to true can output more details.
ids Changes to this property will trigger replacement. List<String>
A list of instance IDs to filter results.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by the instance name.
outputFile String
File name where to save data source results (after running pulumi preview).
status Changes to this property will trigger replacement. Number
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
tags Map<String>
A map of tags assigned to the Ons instance.

getInstances Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
A list of instance IDs.
Instances List<Pulumi.AliCloud.RocketMQ.Outputs.GetInstancesInstance>
A list of instances. Each element contains the following attributes:
Names List<string>
A list of instance names.
EnableDetails bool
NameRegex string
OutputFile string
Status int
The status of the instance. Read Fields in InstanceVO for further details.
Tags Dictionary<string, string>
A map of tags assigned to the Ons instance.
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
A list of instance IDs.
Instances []GetInstancesInstance
A list of instances. Each element contains the following attributes:
Names []string
A list of instance names.
EnableDetails bool
NameRegex string
OutputFile string
Status int
The status of the instance. Read Fields in InstanceVO for further details.
Tags map[string]string
A map of tags assigned to the Ons instance.
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
A list of instance IDs.
instances List<GetInstancesInstance>
A list of instances. Each element contains the following attributes:
names List<String>
A list of instance names.
enableDetails Boolean
nameRegex String
outputFile String
status Integer
The status of the instance. Read Fields in InstanceVO for further details.
tags Map<String,String>
A map of tags assigned to the Ons instance.
id string
The provider-assigned unique ID for this managed resource.
ids string[]
A list of instance IDs.
instances GetInstancesInstance[]
A list of instances. Each element contains the following attributes:
names string[]
A list of instance names.
enableDetails boolean
nameRegex string
outputFile string
status number
The status of the instance. Read Fields in InstanceVO for further details.
tags {[key: string]: string}
A map of tags assigned to the Ons instance.
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
A list of instance IDs.
instances Sequence[GetInstancesInstance]
A list of instances. Each element contains the following attributes:
names Sequence[str]
A list of instance names.
enable_details bool
name_regex str
output_file str
status int
The status of the instance. Read Fields in InstanceVO for further details.
tags Mapping[str, str]
A map of tags assigned to the Ons instance.
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
A list of instance IDs.
instances List<Property Map>
A list of instances. Each element contains the following attributes:
names List<String>
A list of instance names.
enableDetails Boolean
nameRegex String
outputFile String
status Number
The status of the instance. Read Fields in InstanceVO for further details.
tags Map<String>
A map of tags assigned to the Ons instance.

Supporting Types

GetInstancesInstance

HttpInternalEndpoint This property is required. string
The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
HttpInternetEndpoint This property is required. string
The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
HttpInternetSecureEndpoint This property is required. string
The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
Id This property is required. string
ID of the instance.
IndependentNaming This property is required. bool
Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
InstanceId This property is required. string
ID of the instance.
InstanceName This property is required. string
Name of the instance.
InstanceStatus This property is required. int
The status of the instance. Read Fields in InstanceVO for further details.
InstanceType This property is required. int
The type of the instance. Read Fields in InstanceVO for further details.
ReleaseTime This property is required. string
The automatic release time of an Enterprise Platinum Edition instance.
Remark This property is required. string
This attribute is a concise description of instance.
Status This property is required. int
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
Tags This property is required. Dictionary<string, string>
A map of tags assigned to the Ons instance.
TcpEndpoint This property is required. string
The TCP endpoint for the Message Queue for Apache RocketMQ instance.
HttpInternalEndpoint This property is required. string
The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
HttpInternetEndpoint This property is required. string
The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
HttpInternetSecureEndpoint This property is required. string
The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
Id This property is required. string
ID of the instance.
IndependentNaming This property is required. bool
Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
InstanceId This property is required. string
ID of the instance.
InstanceName This property is required. string
Name of the instance.
InstanceStatus This property is required. int
The status of the instance. Read Fields in InstanceVO for further details.
InstanceType This property is required. int
The type of the instance. Read Fields in InstanceVO for further details.
ReleaseTime This property is required. string
The automatic release time of an Enterprise Platinum Edition instance.
Remark This property is required. string
This attribute is a concise description of instance.
Status This property is required. int
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
Tags This property is required. map[string]string
A map of tags assigned to the Ons instance.
TcpEndpoint This property is required. string
The TCP endpoint for the Message Queue for Apache RocketMQ instance.
httpInternalEndpoint This property is required. String
The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
httpInternetEndpoint This property is required. String
The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
httpInternetSecureEndpoint This property is required. String
The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
id This property is required. String
ID of the instance.
independentNaming This property is required. Boolean
Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
instanceId This property is required. String
ID of the instance.
instanceName This property is required. String
Name of the instance.
instanceStatus This property is required. Integer
The status of the instance. Read Fields in InstanceVO for further details.
instanceType This property is required. Integer
The type of the instance. Read Fields in InstanceVO for further details.
releaseTime This property is required. String
The automatic release time of an Enterprise Platinum Edition instance.
remark This property is required. String
This attribute is a concise description of instance.
status This property is required. Integer
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
tags This property is required. Map<String,String>
A map of tags assigned to the Ons instance.
tcpEndpoint This property is required. String
The TCP endpoint for the Message Queue for Apache RocketMQ instance.
httpInternalEndpoint This property is required. string
The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
httpInternetEndpoint This property is required. string
The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
httpInternetSecureEndpoint This property is required. string
The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
id This property is required. string
ID of the instance.
independentNaming This property is required. boolean
Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
instanceId This property is required. string
ID of the instance.
instanceName This property is required. string
Name of the instance.
instanceStatus This property is required. number
The status of the instance. Read Fields in InstanceVO for further details.
instanceType This property is required. number
The type of the instance. Read Fields in InstanceVO for further details.
releaseTime This property is required. string
The automatic release time of an Enterprise Platinum Edition instance.
remark This property is required. string
This attribute is a concise description of instance.
status This property is required. number
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
tags This property is required. {[key: string]: string}
A map of tags assigned to the Ons instance.
tcpEndpoint This property is required. string
The TCP endpoint for the Message Queue for Apache RocketMQ instance.
http_internal_endpoint This property is required. str
The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
http_internet_endpoint This property is required. str
The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
http_internet_secure_endpoint This property is required. str
The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
id This property is required. str
ID of the instance.
independent_naming This property is required. bool
Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
instance_id This property is required. str
ID of the instance.
instance_name This property is required. str
Name of the instance.
instance_status This property is required. int
The status of the instance. Read Fields in InstanceVO for further details.
instance_type This property is required. int
The type of the instance. Read Fields in InstanceVO for further details.
release_time This property is required. str
The automatic release time of an Enterprise Platinum Edition instance.
remark This property is required. str
This attribute is a concise description of instance.
status This property is required. int
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
tags This property is required. Mapping[str, str]
A map of tags assigned to the Ons instance.
tcp_endpoint This property is required. str
The TCP endpoint for the Message Queue for Apache RocketMQ instance.
httpInternalEndpoint This property is required. String
The internal HTTP endpoint for the Message Queue for Apache RocketMQ instance.
httpInternetEndpoint This property is required. String
The public HTTP endpoint for the Message Queue for Apache RocketMQ instance.
httpInternetSecureEndpoint This property is required. String
The public HTTPS endpoint for the Message Queue for Apache RocketMQ instance.
id This property is required. String
ID of the instance.
independentNaming This property is required. Boolean
Indicates whether any namespace is configured for the Message Queue for Apache RocketMQ instance.
instanceId This property is required. String
ID of the instance.
instanceName This property is required. String
Name of the instance.
instanceStatus This property is required. Number
The status of the instance. Read Fields in InstanceVO for further details.
instanceType This property is required. Number
The type of the instance. Read Fields in InstanceVO for further details.
releaseTime This property is required. String
The automatic release time of an Enterprise Platinum Edition instance.
remark This property is required. String
This attribute is a concise description of instance.
status This property is required. Number
The status of Ons instance. Valid values: 0 deploying, 2 arrears, 5 running, 7 upgrading.
tags This property is required. Map<String>
A map of tags assigned to the Ons instance.
tcpEndpoint This property is required. String
The TCP endpoint for the Message Queue for Apache RocketMQ instance.

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