get Dedicated Hosts
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.Apply(getDedicatedHostsResult => getDedicatedHostsResult.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
A collection of arguments for invoking getDedicatedHosts.
Return
A collection of values returned by getDedicatedHosts.
Parameters
The ID of ECS Dedicated Host.
The name of ECS Dedicated Host.
The type of the dedicated host.
A list of ECS Dedicated Host ids.
A regex string to filter results by the ECS Dedicated Host name.
The reason why the dedicated host resource is locked.
Save the result to the file.
The ID of the resource group to which the ECS Dedicated Host belongs.
The status of the ECS Dedicated Host. validate value: Available
, Creating
, PermanentFailure
, Released
, UnderAssessment
.
A mapping of tags to assign to the resource.
The zone ID of the ECS Dedicated Host.
See also
Return
A collection of values returned by getDedicatedHosts.
Parameters
Builder for com.pulumi.alicloud.ecs.kotlin.inputs.GetDedicatedHostsPlainArgs.