getEcsDedicatedHostClusters

This data source provides the Ecs Dedicated Host Clusters of the current Alibaba Cloud user.

NOTE: Available in v1.146.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.ecs.getEcsDedicatedHostClusters({
ids: ["example_id"],
});
export const ecsDedicatedHostClusterId1 = ids.then(ids => ids.clusters?.[0]?.id);
const nameRegex = alicloud.ecs.getEcsDedicatedHostClusters({
nameRegex: "^my-DedicatedHostCluster",
});
export const ecsDedicatedHostClusterId2 = nameRegex.then(nameRegex => nameRegex.clusters?.[0]?.id);
const zoneId = alicloud.ecs.getEcsDedicatedHostClusters({
zoneId: "example_value",
});
export const ecsDedicatedHostClusterId3 = zoneId.then(zoneId => zoneId.clusters?.[0]?.id);
const clusterName = alicloud.ecs.getEcsDedicatedHostClusters({
dedicatedHostClusterName: "example_value",
});
export const ecsDedicatedHostClusterId4 = clusterName.then(clusterName => clusterName.clusters?.[0]?.id);
const clusterIds = alicloud.ecs.getEcsDedicatedHostClusters({
dedicatedHostClusterIds: ["example_id"],
});
export const ecsDedicatedHostClusterId5 = clusterIds.then(clusterIds => clusterIds.clusters?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.ecs.get_ecs_dedicated_host_clusters(ids=["example_id"])
pulumi.export("ecsDedicatedHostClusterId1", ids.clusters[0].id)
name_regex = alicloud.ecs.get_ecs_dedicated_host_clusters(name_regex="^my-DedicatedHostCluster")
pulumi.export("ecsDedicatedHostClusterId2", name_regex.clusters[0].id)
zone_id = alicloud.ecs.get_ecs_dedicated_host_clusters(zone_id="example_value")
pulumi.export("ecsDedicatedHostClusterId3", zone_id.clusters[0].id)
cluster_name = alicloud.ecs.get_ecs_dedicated_host_clusters(dedicated_host_cluster_name="example_value")
pulumi.export("ecsDedicatedHostClusterId4", cluster_name.clusters[0].id)
cluster_ids = alicloud.ecs.get_ecs_dedicated_host_clusters(dedicated_host_cluster_ids=["example_id"])
pulumi.export("ecsDedicatedHostClusterId5", cluster_ids.clusters[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Ecs.GetEcsDedicatedHostClusters.Invoke(new()
{
Ids = new[]
{
"example_id",
},
});
var nameRegex = AliCloud.Ecs.GetEcsDedicatedHostClusters.Invoke(new()
{
NameRegex = "^my-DedicatedHostCluster",
});
var zoneId = AliCloud.Ecs.GetEcsDedicatedHostClusters.Invoke(new()
{
ZoneId = "example_value",
});
var clusterName = AliCloud.Ecs.GetEcsDedicatedHostClusters.Invoke(new()
{
DedicatedHostClusterName = "example_value",
});
var clusterIds = AliCloud.Ecs.GetEcsDedicatedHostClusters.Invoke(new()
{
DedicatedHostClusterIds = new[]
{
"example_id",
},
});
return new Dictionary<string, object?>
{
["ecsDedicatedHostClusterId1"] = ids&#46;Apply(getEcsDedicatedHostClustersResult => getEcsDedicatedHostClustersResult&#46;Clusters[0]?.Id),
["ecsDedicatedHostClusterId2"] = nameRegex&#46;Apply(getEcsDedicatedHostClustersResult => getEcsDedicatedHostClustersResult&#46;Clusters[0]?.Id),
["ecsDedicatedHostClusterId3"] = zoneId&#46;Apply(getEcsDedicatedHostClustersResult => getEcsDedicatedHostClustersResult&#46;Clusters[0]?.Id),
["ecsDedicatedHostClusterId4"] = clusterName&#46;Apply(getEcsDedicatedHostClustersResult => getEcsDedicatedHostClustersResult&#46;Clusters[0]?.Id),
["ecsDedicatedHostClusterId5"] = clusterIds&#46;Apply(getEcsDedicatedHostClustersResult => getEcsDedicatedHostClustersResult&#46;Clusters[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := ecs.GetEcsDedicatedHostClusters(ctx, &ecs.GetEcsDedicatedHostClustersArgs{
Ids: []string{
"example_id",
},
}, nil)
if err != nil {
return err
}
ctx.Export("ecsDedicatedHostClusterId1", ids.Clusters[0].Id)
nameRegex, err := ecs.GetEcsDedicatedHostClusters(ctx, &ecs.GetEcsDedicatedHostClustersArgs{
NameRegex: pulumi.StringRef("^my-DedicatedHostCluster"),
}, nil)
if err != nil {
return err
}
ctx.Export("ecsDedicatedHostClusterId2", nameRegex.Clusters[0].Id)
zoneId, err := ecs.GetEcsDedicatedHostClusters(ctx, &ecs.GetEcsDedicatedHostClustersArgs{
ZoneId: pulumi.StringRef("example_value"),
}, nil)
if err != nil {
return err
}
ctx.Export("ecsDedicatedHostClusterId3", zoneId.Clusters[0].Id)
clusterName, err := ecs.GetEcsDedicatedHostClusters(ctx, &ecs.GetEcsDedicatedHostClustersArgs{
DedicatedHostClusterName: pulumi.StringRef("example_value"),
}, nil)
if err != nil {
return err
}
ctx.Export("ecsDedicatedHostClusterId4", clusterName.Clusters[0].Id)
clusterIds, err := ecs.GetEcsDedicatedHostClusters(ctx, &ecs.GetEcsDedicatedHostClustersArgs{
DedicatedHostClusterIds: []string{
"example_id",
},
}, nil)
if err != nil {
return err
}
ctx.Export("ecsDedicatedHostClusterId5", clusterIds.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.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetEcsDedicatedHostClustersArgs;
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 = EcsFunctions.getEcsDedicatedHostClusters(GetEcsDedicatedHostClustersArgs.builder()
.ids("example_id")
.build());
ctx.export("ecsDedicatedHostClusterId1", ids.clusters()[0].id());
final var nameRegex = EcsFunctions.getEcsDedicatedHostClusters(GetEcsDedicatedHostClustersArgs.builder()
.nameRegex("^my-DedicatedHostCluster")
.build());
ctx.export("ecsDedicatedHostClusterId2", nameRegex.clusters()[0].id());
final var zoneId = EcsFunctions.getEcsDedicatedHostClusters(GetEcsDedicatedHostClustersArgs.builder()
.zoneId("example_value")
.build());
ctx.export("ecsDedicatedHostClusterId3", zoneId.clusters()[0].id());
final var clusterName = EcsFunctions.getEcsDedicatedHostClusters(GetEcsDedicatedHostClustersArgs.builder()
.dedicatedHostClusterName("example_value")
.build());
ctx.export("ecsDedicatedHostClusterId4", clusterName.clusters()[0].id());
final var clusterIds = EcsFunctions.getEcsDedicatedHostClusters(GetEcsDedicatedHostClustersArgs.builder()
.dedicatedHostClusterIds("example_id")
.build());
ctx.export("ecsDedicatedHostClusterId5", clusterIds.clusters()[0].id());
}
}
variables:
ids:
fn::invoke:
function: alicloud:ecs:getEcsDedicatedHostClusters
arguments:
ids:
- example_id
nameRegex:
fn::invoke:
function: alicloud:ecs:getEcsDedicatedHostClusters
arguments:
nameRegex: ^my-DedicatedHostCluster
zoneId:
fn::invoke:
function: alicloud:ecs:getEcsDedicatedHostClusters
arguments:
zoneId: example_value
clusterName:
fn::invoke:
function: alicloud:ecs:getEcsDedicatedHostClusters
arguments:
dedicatedHostClusterName: example_value
clusterIds:
fn::invoke:
function: alicloud:ecs:getEcsDedicatedHostClusters
arguments:
dedicatedHostClusterIds:
- example_id
outputs:
ecsDedicatedHostClusterId1: ${ids.clusters[0].id}
ecsDedicatedHostClusterId2: ${nameRegex.clusters[0].id}
ecsDedicatedHostClusterId3: ${zoneId.clusters[0].id}
ecsDedicatedHostClusterId4: ${clusterName.clusters[0].id}
ecsDedicatedHostClusterId5: ${clusterIds.clusters[0].id}

Return

A collection of values returned by getEcsDedicatedHostClusters.

Parameters

argument

A collection of arguments for invoking getEcsDedicatedHostClusters.


suspend fun getEcsDedicatedHostClusters(dedicatedHostClusterIds: List<String>? = null, dedicatedHostClusterName: String? = null, ids: List<String>? = null, nameRegex: String? = null, outputFile: String? = null, tags: Map<String, String>? = null, zoneId: String? = null): GetEcsDedicatedHostClustersResult

Return

A collection of values returned by getEcsDedicatedHostClusters.

Parameters

dedicatedHostClusterIds

The IDs of dedicated host clusters.

dedicatedHostClusterName

The name of the dedicated host cluster.

ids

A list of Dedicated Host Cluster IDs.

nameRegex

A regex string to filter results by Dedicated Host Cluster name.

outputFile

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

tags

A mapping of tags to assign to the resource.

zoneId

The zone ID of the dedicated host cluster.

See also


Return

A collection of values returned by getEcsDedicatedHostClusters.

Parameters

argument

Builder for com.pulumi.alicloud.ecs.kotlin.inputs.GetEcsDedicatedHostClustersPlainArgs.

See also