get Dedicated Hosts
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.Apply(getDedicatedHostsResult => getDedicatedHostsResult.Hosts[0]?.Id),
["cddcDedicatedHostId2"] = status.Apply(getDedicatedHostsResult => getDedicatedHostsResult.Hosts[0]?.Id),
["cddcDedicatedHostId3"] = zoneId.Apply(getDedicatedHostsResult => getDedicatedHostsResult.Hosts[0]?.Id),
["cddcDedicatedHostId4"] = allocationStatus.Apply(getDedicatedHostsResult => getDedicatedHostsResult.Hosts[0]?.Id),
["cddcDedicatedHostId5"] = hostType.Apply(getDedicatedHostsResult => getDedicatedHostsResult.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
A collection of arguments for invoking getDedicatedHosts.
Return
A collection of values returned by getDedicatedHosts.
Parameters
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.
The ID of the dedicated cluster.
Default to false
. Set it to true
can output more details about resource attributes.
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).
A list of Dedicated Host IDs.
The ID of the order.
File name where to save data source results (after running pulumi preview
).
The state of the host. Valid values:
0:
The host is being created.
A mapping of tags to assign to the resource.
The ID of the zone.
See also
Return
A collection of values returned by getDedicatedHosts.
Parameters
Builder for com.pulumi.alicloud.cddc.kotlin.inputs.GetDedicatedHostsPlainArgs.