getDedicatedHosts

This data source provides the Cddc Dedicated Hosts of the current Alibaba Cloud user.

NOTE: Available in v1.147.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.cddc.getDedicatedHosts({
dedicatedHostGroupId: "example_value",
ids: [
"example_value-1",
"example_value-2",
],
});
export const cddcDedicatedHostId1 = ids.then(ids => ids.hosts?.[0]?.id);
const status = alicloud.cddc.getDedicatedHosts({
dedicatedHostGroupId: "example_value",
ids: [
"example_value-1",
"example_value-2",
],
status: "1",
});
export const cddcDedicatedHostId2 = status.then(status => status.hosts?.[0]?.id);
const zoneId = alicloud.cddc.getDedicatedHosts({
dedicatedHostGroupId: "example_value",
ids: [
"example_value-1",
"example_value-2",
],
zoneId: "example_value",
});
export const cddcDedicatedHostId3 = zoneId.then(zoneId => zoneId.hosts?.[0]?.id);
const allocationStatus = alicloud.cddc.getDedicatedHosts({
dedicatedHostGroupId: "example_value",
ids: [
"example_value-1",
"example_value-2",
],
allocationStatus: "Allocatable",
});
export const cddcDedicatedHostId4 = allocationStatus.then(allocationStatus => allocationStatus.hosts?.[0]?.id);
const hostType = alicloud.cddc.getDedicatedHosts({
dedicatedHostGroupId: "example_value",
ids: [
"example_value-1",
"example_value-2",
],
hostType: "dhg_cloud_ssd",
});
export const cddcDedicatedHostId5 = hostType.then(hostType => hostType.hosts?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.cddc.get_dedicated_hosts(dedicated_host_group_id="example_value",
ids=[
"example_value-1",
"example_value-2",
])
pulumi.export("cddcDedicatedHostId1", ids.hosts[0].id)
status = alicloud.cddc.get_dedicated_hosts(dedicated_host_group_id="example_value",
ids=[
"example_value-1",
"example_value-2",
],
status="1")
pulumi.export("cddcDedicatedHostId2", status.hosts[0].id)
zone_id = alicloud.cddc.get_dedicated_hosts(dedicated_host_group_id="example_value",
ids=[
"example_value-1",
"example_value-2",
],
zone_id="example_value")
pulumi.export("cddcDedicatedHostId3", zone_id.hosts[0].id)
allocation_status = alicloud.cddc.get_dedicated_hosts(dedicated_host_group_id="example_value",
ids=[
"example_value-1",
"example_value-2",
],
allocation_status="Allocatable")
pulumi.export("cddcDedicatedHostId4", allocation_status.hosts[0].id)
host_type = alicloud.cddc.get_dedicated_hosts(dedicated_host_group_id="example_value",
ids=[
"example_value-1",
"example_value-2",
],
host_type="dhg_cloud_ssd")
pulumi.export("cddcDedicatedHostId5", host_type.hosts[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Cddc.GetDedicatedHosts.Invoke(new()
{
DedicatedHostGroupId = "example_value",
Ids = new[]
{
"example_value-1",
"example_value-2",
},
});
var status = AliCloud.Cddc.GetDedicatedHosts.Invoke(new()
{
DedicatedHostGroupId = "example_value",
Ids = new[]
{
"example_value-1",
"example_value-2",
},
Status = "1",
});
var zoneId = AliCloud.Cddc.GetDedicatedHosts.Invoke(new()
{
DedicatedHostGroupId = "example_value",
Ids = new[]
{
"example_value-1",
"example_value-2",
},
ZoneId = "example_value",
});
var allocationStatus = AliCloud.Cddc.GetDedicatedHosts.Invoke(new()
{
DedicatedHostGroupId = "example_value",
Ids = new[]
{
"example_value-1",
"example_value-2",
},
AllocationStatus = "Allocatable",
});
var hostType = AliCloud.Cddc.GetDedicatedHosts.Invoke(new()
{
DedicatedHostGroupId = "example_value",
Ids = new[]
{
"example_value-1",
"example_value-2",
},
HostType = "dhg_cloud_ssd",
});
return new Dictionary<string, object?>
{
["cddcDedicatedHostId1"] = ids&#46;Apply(getDedicatedHostsResult => getDedicatedHostsResult&#46;Hosts[0]?.Id),
["cddcDedicatedHostId2"] = status&#46;Apply(getDedicatedHostsResult => getDedicatedHostsResult&#46;Hosts[0]?.Id),
["cddcDedicatedHostId3"] = zoneId&#46;Apply(getDedicatedHostsResult => getDedicatedHostsResult&#46;Hosts[0]?.Id),
["cddcDedicatedHostId4"] = allocationStatus&#46;Apply(getDedicatedHostsResult => getDedicatedHostsResult&#46;Hosts[0]?.Id),
["cddcDedicatedHostId5"] = hostType&#46;Apply(getDedicatedHostsResult => getDedicatedHostsResult&#46;Hosts[0]?.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cddc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ids, err := cddc.GetDedicatedHosts(ctx, &cddc.GetDedicatedHostsArgs{
DedicatedHostGroupId: "example_value",
Ids: []string{
"example_value-1",
"example_value-2",
},
}, nil)
if err != nil {
return err
}
ctx.Export("cddcDedicatedHostId1", ids.Hosts[0].Id)
status, err := cddc.GetDedicatedHosts(ctx, &cddc.GetDedicatedHostsArgs{
DedicatedHostGroupId: "example_value",
Ids: []string{
"example_value-1",
"example_value-2",
},
Status: pulumi.StringRef("1"),
}, nil)
if err != nil {
return err
}
ctx.Export("cddcDedicatedHostId2", status.Hosts[0].Id)
zoneId, err := cddc.GetDedicatedHosts(ctx, &cddc.GetDedicatedHostsArgs{
DedicatedHostGroupId: "example_value",
Ids: []string{
"example_value-1",
"example_value-2",
},
ZoneId: pulumi.StringRef("example_value"),
}, nil)
if err != nil {
return err
}
ctx.Export("cddcDedicatedHostId3", zoneId.Hosts[0].Id)
allocationStatus, err := cddc.GetDedicatedHosts(ctx, &cddc.GetDedicatedHostsArgs{
DedicatedHostGroupId: "example_value",
Ids: []string{
"example_value-1",
"example_value-2",
},
AllocationStatus: pulumi.StringRef("Allocatable"),
}, nil)
if err != nil {
return err
}
ctx.Export("cddcDedicatedHostId4", allocationStatus.Hosts[0].Id)
hostType, err := cddc.GetDedicatedHosts(ctx, &cddc.GetDedicatedHostsArgs{
DedicatedHostGroupId: "example_value",
Ids: []string{
"example_value-1",
"example_value-2",
},
HostType: pulumi.StringRef("dhg_cloud_ssd"),
}, nil)
if err != nil {
return err
}
ctx.Export("cddcDedicatedHostId5", hostType.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.cddc.CddcFunctions;
import com.pulumi.alicloud.cddc.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) {
final var ids = CddcFunctions.getDedicatedHosts(GetDedicatedHostsArgs.builder()
.dedicatedHostGroupId("example_value")
.ids(
"example_value-1",
"example_value-2")
.build());
ctx.export("cddcDedicatedHostId1", ids.hosts()[0].id());
final var status = CddcFunctions.getDedicatedHosts(GetDedicatedHostsArgs.builder()
.dedicatedHostGroupId("example_value")
.ids(
"example_value-1",
"example_value-2")
.status("1")
.build());
ctx.export("cddcDedicatedHostId2", status.hosts()[0].id());
final var zoneId = CddcFunctions.getDedicatedHosts(GetDedicatedHostsArgs.builder()
.dedicatedHostGroupId("example_value")
.ids(
"example_value-1",
"example_value-2")
.zoneId("example_value")
.build());
ctx.export("cddcDedicatedHostId3", zoneId.hosts()[0].id());
final var allocationStatus = CddcFunctions.getDedicatedHosts(GetDedicatedHostsArgs.builder()
.dedicatedHostGroupId("example_value")
.ids(
"example_value-1",
"example_value-2")
.allocationStatus("Allocatable")
.build());
ctx.export("cddcDedicatedHostId4", allocationStatus.hosts()[0].id());
final var hostType = CddcFunctions.getDedicatedHosts(GetDedicatedHostsArgs.builder()
.dedicatedHostGroupId("example_value")
.ids(
"example_value-1",
"example_value-2")
.hostType("dhg_cloud_ssd")
.build());
ctx.export("cddcDedicatedHostId5", hostType.hosts()[0].id());
}
}
variables:
ids:
fn::invoke:
function: alicloud:cddc:getDedicatedHosts
arguments:
dedicatedHostGroupId: example_value
ids:
- example_value-1
- example_value-2
status:
fn::invoke:
function: alicloud:cddc:getDedicatedHosts
arguments:
dedicatedHostGroupId: example_value
ids:
- example_value-1
- example_value-2
status: '1'
zoneId:
fn::invoke:
function: alicloud:cddc:getDedicatedHosts
arguments:
dedicatedHostGroupId: example_value
ids:
- example_value-1
- example_value-2
zoneId: example_value
allocationStatus:
fn::invoke:
function: alicloud:cddc:getDedicatedHosts
arguments:
dedicatedHostGroupId: example_value
ids:
- example_value-1
- example_value-2
allocationStatus: Allocatable
hostType:
fn::invoke:
function: alicloud:cddc:getDedicatedHosts
arguments:
dedicatedHostGroupId: example_value
ids:
- example_value-1
- example_value-2
hostType: dhg_cloud_ssd
outputs:
cddcDedicatedHostId1: ${ids.hosts[0].id}
cddcDedicatedHostId2: ${status.hosts[0].id}
cddcDedicatedHostId3: ${zoneId.hosts[0].id}
cddcDedicatedHostId4: ${allocationStatus.hosts[0].id}
cddcDedicatedHostId5: ${hostType.hosts[0].id}

Return

A collection of values returned by getDedicatedHosts.

Parameters

argument

A collection of arguments for invoking getDedicatedHosts.


suspend fun getDedicatedHosts(allocationStatus: String? = null, dedicatedHostGroupId: String, enableDetails: Boolean? = null, hostType: String? = null, ids: List<String>? = null, orderId: String? = null, outputFile: String? = null, status: String? = null, tags: Map<String, String>? = null, zoneId: String? = null): GetDedicatedHostsResult

Return

A collection of values returned by getDedicatedHosts.

Parameters

allocationStatus

Specifies whether instances can be created on the host. Valid values: Allocatable or Suspended. Allocatable: Instances can be created on the host. Suspended: Instances cannot be created on the host.

dedicatedHostGroupId

The ID of the dedicated cluster.

enableDetails

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

hostType

The storage type of the host. Valid values: dhg_local_ssd or dhg_cloud_ssd. dhg_local_ssd: specifies that the host uses local SSDs. dhg_cloud_ssd: specifies that the host uses enhanced SSDs (ESSDs).

ids

A list of Dedicated Host IDs.

orderId

The ID of the order.

outputFile

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

status

The state of the host. Valid values:

  • 0: The host is being created.

tags

A mapping of tags to assign to the resource.

zoneId

The ID of the zone.

See also


Return

A collection of values returned by getDedicatedHosts.

Parameters

argument

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

See also