Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

getComputeCluster

The vsphere.ComputeCluster data source can be used to discover the ID of a cluster in vSphere. This is useful to fetch the ID of a cluster that you want to use for virtual machine placement via the vsphere.VirtualMachine resource, allowing you to specify the cluster’s root resource pool directly versus using the alias available through the vsphere.ResourcePool data source.

You may also wish to see the vsphere.ComputeCluster resource for further details about clusters or how to work with them.

Example Usage

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
        {
            Name = "dc1",
        }));
        var computeCluster = Output.Create(VSphere.GetComputeCluster.InvokeAsync(new VSphere.GetComputeClusterArgs
        {
            DatacenterId = data.Vsphere_datacenter.Dc.Id,
            Name = "compute-cluster1",
        }));
    }

}
package main

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

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := "dc1"
        _, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
            Name: &opt0,
        }, nil)
        if err != nil {
            return err
        }
        opt1 := data.Vsphere_datacenter.Dc.Id
        _, err = vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{
            DatacenterId: &opt1,
            Name:         "compute-cluster1",
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_vsphere as vsphere

datacenter = vsphere.get_datacenter(name="dc1")
compute_cluster = vsphere.get_compute_cluster(datacenter_id=data["vsphere_datacenter"]["dc"]["id"],
    name="compute-cluster1")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const datacenter = pulumi.output(vsphere.getDatacenter({
    name: "dc1",
}, { async: true }));
const computeCluster = vsphere_datacenter_dc.id.apply(id => vsphere.getComputeCluster({
    datacenterId: id,
    name: "compute-cluster1",
}, { async: true }));

Using getComputeCluster

function getComputeCluster(args: GetComputeClusterArgs, opts?: InvokeOptions): Promise<GetComputeClusterResult>
def get_compute_cluster(datacenter_id: Optional[str] = None, name: Optional[str] = None, opts: Optional[InvokeOptions] = None) -> GetComputeClusterResult
func LookupComputeCluster(ctx *Context, args *LookupComputeClusterArgs, opts ...InvokeOption) (*LookupComputeClusterResult, error)

Note: This function is named LookupComputeCluster in the Go SDK.

public static class GetComputeCluster {
    public static Task<GetComputeClusterResult> InvokeAsync(GetComputeClusterArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string

The name or absolute path to the cluster.

DatacenterId string

The managed object reference ID of the datacenter the cluster is located in. This can be omitted if the search path used in name is an absolute path. For default datacenters, use the id attribute from an empty vsphere.Datacenter data source.

Name string

The name or absolute path to the cluster.

DatacenterId string

The managed object reference ID of the datacenter the cluster is located in. This can be omitted if the search path used in name is an absolute path. For default datacenters, use the id attribute from an empty vsphere.Datacenter data source.

name string

The name or absolute path to the cluster.

datacenterId string

The managed object reference ID of the datacenter the cluster is located in. This can be omitted if the search path used in name is an absolute path. For default datacenters, use the id attribute from an empty vsphere.Datacenter data source.

name str

The name or absolute path to the cluster.

datacenter_id str

The managed object reference ID of the datacenter the cluster is located in. This can be omitted if the search path used in name is an absolute path. For default datacenters, use the id attribute from an empty vsphere.Datacenter data source.

getComputeCluster Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Name string
ResourcePoolId string
DatacenterId string
Id string

The provider-assigned unique ID for this managed resource.

Name string
ResourcePoolId string
DatacenterId string
id string

The provider-assigned unique ID for this managed resource.

name string
resourcePoolId string
datacenterId string
id str

The provider-assigned unique ID for this managed resource.

name str
resource_pool_id str
datacenter_id str

Package Details

Repository
https://github.com/pulumi/pulumi-vsphere
License
Apache-2.0
Notes
This Pulumi package is based on the vsphere Terraform Provider.