vSphere

Pulumi Official
Package maintained by Pulumi
v4.3.0 published on Monday, Jun 27, 2022 by Pulumi

getComputeClusterHostGroup

The vsphere.ComputeClusterHostGroup data source can be used to discover the IDs ESXi hosts in a host group and return host group attributes to other resources.

Example Usage

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
        {
            Name = @var.Vsphere_datacenter,
        }));
        var cluster = datacenter.Apply(datacenter => Output.Create(VSphere.GetComputeCluster.InvokeAsync(new VSphere.GetComputeClusterArgs
        {
            Name = @var.Vsphere_cluster,
            DatacenterId = datacenter.Id,
        })));
        var hostGroup1 = cluster.Apply(cluster => Output.Create(VSphere.GetComputeClusterHostGroup.InvokeAsync(new VSphere.GetComputeClusterHostGroupArgs
        {
            Name = "host_group1",
            ComputeClusterId = cluster.Id,
        })));
        var hostRule1 = new VSphere.ComputeClusterVmHostRule("hostRule1", new VSphere.ComputeClusterVmHostRuleArgs
        {
            ComputeClusterId = cluster.Apply(cluster => cluster.Id),
            VmGroupName = "vm_group1",
            AffinityHostGroupName = hostGroup1.Apply(hostGroup1 => hostGroup1.Name),
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		datacenter, err := vsphere.LookupDatacenter(ctx, &GetDatacenterArgs{
			Name: pulumi.StringRef(_var.Vsphere_datacenter),
		}, nil)
		if err != nil {
			return err
		}
		cluster, err := vsphere.LookupComputeCluster(ctx, &GetComputeClusterArgs{
			Name:         _var.Vsphere_cluster,
			DatacenterId: pulumi.StringRef(datacenter.Id),
		}, nil)
		if err != nil {
			return err
		}
		hostGroup1, err := vsphere.LookupComputeClusterHostGroup(ctx, &GetComputeClusterHostGroupArgs{
			Name:             "host_group1",
			ComputeClusterId: cluster.Id,
		}, nil)
		if err != nil {
			return err
		}
		_, err = vsphere.NewComputeClusterVmHostRule(ctx, "hostRule1", &vsphere.ComputeClusterVmHostRuleArgs{
			ComputeClusterId:      pulumi.String(cluster.Id),
			VmGroupName:           pulumi.String("vm_group1"),
			AffinityHostGroupName: pulumi.String(hostGroup1.Name),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_vsphere as vsphere

datacenter = vsphere.get_datacenter(name=var["vsphere_datacenter"])
cluster = vsphere.get_compute_cluster(name=var["vsphere_cluster"],
    datacenter_id=datacenter.id)
host_group1 = vsphere.get_compute_cluster_host_group(name="host_group1",
    compute_cluster_id=cluster.id)
host_rule1 = vsphere.ComputeClusterVmHostRule("hostRule1",
    compute_cluster_id=cluster.id,
    vm_group_name="vm_group1",
    affinity_host_group_name=host_group1.name)
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const datacenter = vsphere.getDatacenter({
    name: _var.vsphere_datacenter,
});
const cluster = datacenter.then(datacenter => vsphere.getComputeCluster({
    name: _var.vsphere_cluster,
    datacenterId: datacenter.id,
}));
const hostGroup1 = cluster.then(cluster => vsphere.getComputeClusterHostGroup({
    name: "host_group1",
    computeClusterId: cluster.id,
}));
const hostRule1 = new vsphere.ComputeClusterVmHostRule("hostRule1", {
    computeClusterId: cluster.then(cluster => cluster.id),
    vmGroupName: "vm_group1",
    affinityHostGroupName: hostGroup1.then(hostGroup1 => hostGroup1.name),
});

Coming soon!

Using getComputeClusterHostGroup

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getComputeClusterHostGroup(args: GetComputeClusterHostGroupArgs, opts?: InvokeOptions): Promise<GetComputeClusterHostGroupResult>
function getComputeClusterHostGroupOutput(args: GetComputeClusterHostGroupOutputArgs, opts?: InvokeOptions): Output<GetComputeClusterHostGroupResult>
def get_compute_cluster_host_group(compute_cluster_id: Optional[str] = None,
                                   name: Optional[str] = None,
                                   opts: Optional[InvokeOptions] = None) -> GetComputeClusterHostGroupResult
def get_compute_cluster_host_group_output(compute_cluster_id: Optional[pulumi.Input[str]] = None,
                                   name: Optional[pulumi.Input[str]] = None,
                                   opts: Optional[InvokeOptions] = None) -> Output[GetComputeClusterHostGroupResult]
func LookupComputeClusterHostGroup(ctx *Context, args *LookupComputeClusterHostGroupArgs, opts ...InvokeOption) (*LookupComputeClusterHostGroupResult, error)
func LookupComputeClusterHostGroupOutput(ctx *Context, args *LookupComputeClusterHostGroupOutputArgs, opts ...InvokeOption) LookupComputeClusterHostGroupResultOutput

> Note: This function is named LookupComputeClusterHostGroup in the Go SDK.

public static class GetComputeClusterHostGroup 
{
    public static Task<GetComputeClusterHostGroupResult> InvokeAsync(GetComputeClusterHostGroupArgs args, InvokeOptions? opts = null)
    public static Output<GetComputeClusterHostGroupResult> Invoke(GetComputeClusterHostGroupInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetComputeClusterHostGroupResult> getComputeClusterHostGroup(GetComputeClusterHostGroupArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: vsphere:index/getComputeClusterHostGroup:getComputeClusterHostGroup
  Arguments:
    # Arguments dictionary

The following arguments are supported:

ComputeClusterId string

The [managed object reference ID][docs-about-morefs] of the compute cluster for the host group.

Name string

The name of the host group.

ComputeClusterId string

The [managed object reference ID][docs-about-morefs] of the compute cluster for the host group.

Name string

The name of the host group.

computeClusterId String

The [managed object reference ID][docs-about-morefs] of the compute cluster for the host group.

name String

The name of the host group.

computeClusterId string

The [managed object reference ID][docs-about-morefs] of the compute cluster for the host group.

name string

The name of the host group.

compute_cluster_id str

The [managed object reference ID][docs-about-morefs] of the compute cluster for the host group.

name str

The name of the host group.

computeClusterId String

The [managed object reference ID][docs-about-morefs] of the compute cluster for the host group.

name String

The name of the host group.

getComputeClusterHostGroup Result

The following output properties are available:

ComputeClusterId string
HostSystemIds List<string>
Id string

The provider-assigned unique ID for this managed resource.

Name string
ComputeClusterId string
HostSystemIds []string
Id string

The provider-assigned unique ID for this managed resource.

Name string
computeClusterId String
hostSystemIds List<String>
id String

The provider-assigned unique ID for this managed resource.

name String
computeClusterId string
hostSystemIds string[]
id string

The provider-assigned unique ID for this managed resource.

name string
compute_cluster_id str
host_system_ids Sequence[str]
id str

The provider-assigned unique ID for this managed resource.

name str
computeClusterId String
hostSystemIds List<String>
id String

The provider-assigned unique ID for this managed resource.

name String

Package Details

Repository
https://github.com/pulumi/pulumi-vsphere
License
Apache-2.0
Notes

This Pulumi package is based on the vsphere Terraform Provider.