getClusters

This data source provides the Ehpc Clusters of the current Alibaba Cloud user.

NOTE: Available since v1.173.0.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.ehpc.getClusters({
ids: ["example_id"],
});
export const ehpcClusterId1 = ids.then(ids => ids.clusters?.[0]?.id);
const nameRegex = alicloud.ehpc.getClusters({
nameRegex: "^my-Cluster",
});
export const ehpcClusterId2 = nameRegex.then(nameRegex => nameRegex.clusters?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.ehpc.get_clusters(ids=["example_id"])
pulumi.export("ehpcClusterId1", ids.clusters[0].id)
name_regex = alicloud.ehpc.get_clusters(name_regex="^my-Cluster")
pulumi.export("ehpcClusterId2", name_regex.clusters[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Ehpc.GetClusters.Invoke(new()
{
Ids = new[]
{
"example_id",
},
});
var nameRegex = AliCloud.Ehpc.GetClusters.Invoke(new()
{
NameRegex = "^my-Cluster",
});
return new Dictionary<string, object?>
{
["ehpcClusterId1"] = ids&#46;Apply(getClustersResult => getClustersResult&#46;Clusters[0]?.Id),
["ehpcClusterId2"] = nameRegex&#46;Apply(getClustersResult => getClustersResult&#46;Clusters[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ehpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := ehpc.GetClusters(ctx, &ehpc.GetClustersArgs{
Ids: []string{
"example_id",
},
}, nil)
if err != nil {
return err
}
ctx.Export("ehpcClusterId1", ids.Clusters[0].Id)
nameRegex, err := ehpc.GetClusters(ctx, &ehpc.GetClustersArgs{
NameRegex: pulumi.StringRef("^my-Cluster"),
}, nil)
if err != nil {
return err
}
ctx.Export("ehpcClusterId2", nameRegex.Clusters[0].Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ehpc.EhpcFunctions;
import com.pulumi.alicloud.ehpc.inputs.GetClustersArgs;
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 ids = EhpcFunctions.getClusters(GetClustersArgs.builder()
.ids("example_id")
.build());
ctx.export("ehpcClusterId1", ids.clusters()[0].id());
final var nameRegex = EhpcFunctions.getClusters(GetClustersArgs.builder()
.nameRegex("^my-Cluster")
.build());
ctx.export("ehpcClusterId2", nameRegex.clusters()[0].id());
}
}
variables:
ids:
fn::invoke:
function: alicloud:ehpc:getClusters
arguments:
ids:
- example_id
nameRegex:
fn::invoke:
function: alicloud:ehpc:getClusters
arguments:
nameRegex: ^my-Cluster
outputs:
ehpcClusterId1: ${ids.clusters[0].id}
ehpcClusterId2: ${nameRegex.clusters[0].id}

Return

A collection of values returned by getClusters.

Parameters

argument

A collection of arguments for invoking getClusters.


suspend fun getClusters(enableDetails: Boolean? = null, ids: List<String>? = null, nameRegex: String? = null, outputFile: String? = null, status: String? = null): GetClustersResult

Return

A collection of values returned by getClusters.

Parameters

enableDetails

Default to false. Set it to true can output more details about resource attributes.

ids

A list of Cluster IDs.

nameRegex

A regex string to filter results by Cluster name.

outputFile

File name where to save data source results (after running pulumi preview).

status

The status of the resource. Valid values:

See also


suspend fun getClusters(argument: suspend GetClustersPlainArgsBuilder.() -> Unit): GetClustersResult

Return

A collection of values returned by getClusters.

Parameters

argument

Builder for com.pulumi.alicloud.ehpc.kotlin.inputs.GetClustersPlainArgs.

See also