1. Packages
  2. vSphere
  3. API Docs
  4. getComputeCluster
vSphere v4.10.1 published on Friday, May 10, 2024 by Pulumi

vsphere.getComputeCluster

Explore with Pulumi AI

vsphere logo
vSphere v4.10.1 published on Friday, May 10, 2024 by Pulumi

    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 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 more information about clusters and how to managed the resource in this provider.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vsphere from "@pulumi/vsphere";
    
    const datacenter = vsphere.getDatacenter({
        name: "dc-01",
    });
    const computeCluster = datacenter.then(datacenter => vsphere.getComputeCluster({
        name: "cluster-01",
        datacenterId: datacenter.id,
    }));
    
    import pulumi
    import pulumi_vsphere as vsphere
    
    datacenter = vsphere.get_datacenter(name="dc-01")
    compute_cluster = vsphere.get_compute_cluster(name="cluster-01",
        datacenter_id=datacenter.id)
    
    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, &vsphere.LookupDatacenterArgs{
    			Name: pulumi.StringRef("dc-01"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = vsphere.LookupComputeCluster(ctx, &vsphere.LookupComputeClusterArgs{
    			Name:         "cluster-01",
    			DatacenterId: pulumi.StringRef(datacenter.Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using VSphere = Pulumi.VSphere;
    
    return await Deployment.RunAsync(() => 
    {
        var datacenter = VSphere.GetDatacenter.Invoke(new()
        {
            Name = "dc-01",
        });
    
        var computeCluster = VSphere.GetComputeCluster.Invoke(new()
        {
            Name = "cluster-01",
            DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vsphere.VsphereFunctions;
    import com.pulumi.vsphere.inputs.GetDatacenterArgs;
    import com.pulumi.vsphere.inputs.GetComputeClusterArgs;
    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 datacenter = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
                .name("dc-01")
                .build());
    
            final var computeCluster = VsphereFunctions.getComputeCluster(GetComputeClusterArgs.builder()
                .name("cluster-01")
                .datacenterId(datacenter.applyValue(getDatacenterResult -> getDatacenterResult.id()))
                .build());
    
        }
    }
    
    variables:
      datacenter:
        fn::invoke:
          Function: vsphere:getDatacenter
          Arguments:
            name: dc-01
      computeCluster:
        fn::invoke:
          Function: vsphere:getComputeCluster
          Arguments:
            name: cluster-01
            datacenterId: ${datacenter.id}
    

    Using getComputeCluster

    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 getComputeCluster(args: GetComputeClusterArgs, opts?: InvokeOptions): Promise<GetComputeClusterResult>
    function getComputeClusterOutput(args: GetComputeClusterOutputArgs, opts?: InvokeOptions): Output<GetComputeClusterResult>
    def get_compute_cluster(datacenter_id: Optional[str] = None,
                            name: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetComputeClusterResult
    def get_compute_cluster_output(datacenter_id: Optional[pulumi.Input[str]] = None,
                            name: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetComputeClusterResult]
    func LookupComputeCluster(ctx *Context, args *LookupComputeClusterArgs, opts ...InvokeOption) (*LookupComputeClusterResult, error)
    func LookupComputeClusterOutput(ctx *Context, args *LookupComputeClusterOutputArgs, opts ...InvokeOption) LookupComputeClusterResultOutput

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

    public static class GetComputeCluster 
    {
        public static Task<GetComputeClusterResult> InvokeAsync(GetComputeClusterArgs args, InvokeOptions? opts = null)
        public static Output<GetComputeClusterResult> Invoke(GetComputeClusterInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetComputeClusterResult> getComputeCluster(GetComputeClusterArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: vsphere:index/getComputeCluster:getComputeCluster
      arguments:
        # arguments dictionary

    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 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.
    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.

    getComputeCluster Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    ResourcePoolId string
    The managed object reference ID of the root resource pool for the cluster.
    DatacenterId string
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    ResourcePoolId string
    The managed object reference ID of the root resource pool for the cluster.
    DatacenterId string
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    resourcePoolId String
    The managed object reference ID of the root resource pool for the cluster.
    datacenterId String
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    resourcePoolId string
    The managed object reference ID of the root resource pool for the cluster.
    datacenterId string
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    resource_pool_id str
    The managed object reference ID of the root resource pool for the cluster.
    datacenter_id str
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    resourcePoolId String
    The managed object reference ID of the root resource pool for the cluster.
    datacenterId String

    Package Details

    Repository
    vSphere pulumi/pulumi-vsphere
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vsphere Terraform Provider.
    vsphere logo
    vSphere v4.10.1 published on Friday, May 10, 2024 by Pulumi