getDedicatedHosts

This data source provides a list of ECS Dedicated Hosts in an Alibaba Cloud account according to the specified filters.

NOTE: Available in v1.91.0+.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
// Declare the data source
const dedicatedHostsDs = alicloud.ecs.getDedicatedHosts({
nameRegex: "tf-testAcc",
dedicatedHostType: "ddh.g5",
status: "Available",
});
export const firstDedicatedHostsId = dedicatedHostsDs.then(dedicatedHostsDs => dedicatedHostsDs.hosts?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
# Declare the data source
dedicated_hosts_ds = alicloud.ecs.get_dedicated_hosts(name_regex="tf-testAcc",
dedicated_host_type="ddh.g5",
status="Available")
pulumi.export("firstDedicatedHostsId", dedicated_hosts_ds.hosts[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
// Declare the data source
var dedicatedHostsDs = AliCloud.Ecs.GetDedicatedHosts.Invoke(new()
{
NameRegex = "tf-testAcc",
DedicatedHostType = "ddh.g5",
Status = "Available",
});
return new Dictionary<string, object?>
{
["firstDedicatedHostsId"] = dedicatedHostsDs&#46;Apply(getDedicatedHostsResult => getDedicatedHostsResult&#46;Hosts[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 {
// Declare the data source
dedicatedHostsDs, err := ecs.GetDedicatedHosts(ctx, &ecs.GetDedicatedHostsArgs{
NameRegex: pulumi.StringRef("tf-testAcc"),
DedicatedHostType: pulumi.StringRef("ddh.g5"),
Status: pulumi.StringRef("Available"),
}, nil)
if err != nil {
return err
}
ctx.Export("firstDedicatedHostsId", dedicatedHostsDs.Hosts[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.GetDedicatedHostsArgs;
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) {
// Declare the data source
final var dedicatedHostsDs = EcsFunctions.getDedicatedHosts(GetDedicatedHostsArgs.builder()
.nameRegex("tf-testAcc")
.dedicatedHostType("ddh.g5")
.status("Available")
.build());
ctx.export("firstDedicatedHostsId", dedicatedHostsDs.applyValue(getDedicatedHostsResult -> getDedicatedHostsResult.hosts()[0].id()));
}
}
variables:
# Declare the data source
dedicatedHostsDs:
fn::invoke:
function: alicloud:ecs:getDedicatedHosts
arguments:
nameRegex: tf-testAcc
dedicatedHostType: ddh.g5
status: Available
outputs:
firstDedicatedHostsId: ${dedicatedHostsDs.hosts[0].id}

Return

A collection of values returned by getDedicatedHosts.

Parameters

argument

A collection of arguments for invoking getDedicatedHosts.


suspend fun getDedicatedHosts(dedicatedHostId: String? = null, dedicatedHostName: String? = null, dedicatedHostType: String? = null, ids: List<String>? = null, nameRegex: String? = null, operationLocks: List<GetDedicatedHostsOperationLock>? = null, outputFile: String? = null, resourceGroupId: String? = null, status: String? = null, tags: Map<String, String>? = null, zoneId: String? = null): GetDedicatedHostsResult

Return

A collection of values returned by getDedicatedHosts.

Parameters

dedicatedHostId

The ID of ECS Dedicated Host.

dedicatedHostName

The name of ECS Dedicated Host.

dedicatedHostType

The type of the dedicated host.

ids

A list of ECS Dedicated Host ids.

nameRegex

A regex string to filter results by the ECS Dedicated Host name.

operationLocks

The reason why the dedicated host resource is locked.

outputFile

Save the result to the file.

resourceGroupId

The ID of the resource group to which the ECS Dedicated Host belongs.

status

The status of the ECS Dedicated Host. validate value: Available, Creating, PermanentFailure, Released, UnderAssessment.

tags

A mapping of tags to assign to the resource.

zoneId

The zone ID of the ECS Dedicated Host.

See also


Return

A collection of values returned by getDedicatedHosts.

Parameters

argument

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

See also