vSphere

Pulumi Official
Package maintained by Pulumi
v4.1.0 published on Wednesday, Nov 24, 2021 by Pulumi

getResourcePool

The vsphere.ResourcePool data source can be used to discover the ID of a resource pool in vSphere. This is useful to fetch the ID of a resource pool that you want to use to create virtual machines in using the vsphere.VirtualMachine resource.

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 pool = datacenter.Apply(datacenter => Output.Create(VSphere.GetResourcePool.InvokeAsync(new VSphere.GetResourcePoolArgs
        {
            DatacenterId = datacenter.Id,
            Name = "resource-pool-1",
        })));
    }

}
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 {
		opt0 := "dc1"
		datacenter, err := vsphere.LookupDatacenter(ctx, &GetDatacenterArgs{
			Name: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		opt1 := datacenter.Id
		opt2 := "resource-pool-1"
		_, err = vsphere.LookupResourcePool(ctx, &GetResourcePoolArgs{
			DatacenterId: &opt1,
			Name:         &opt2,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_vsphere as vsphere

datacenter = vsphere.get_datacenter(name="dc1")
pool = vsphere.get_resource_pool(datacenter_id=datacenter.id,
    name="resource-pool-1")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const datacenter = pulumi.output(vsphere.getDatacenter({
    name: "dc1",
}));
const pool = datacenter.apply(datacenter => vsphere.getResourcePool({
    datacenterId: datacenter.id,
    name: "resource-pool-1",
}));

Coming soon!

Specifying the root resource pool for a standalone host

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var pool = Output.Create(VSphere.GetResourcePool.InvokeAsync(new VSphere.GetResourcePoolArgs
        {
            DatacenterId = data.Vsphere_datacenter.Dc.Id,
            Name = "esxi1/Resources",
        }));
    }

}
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 {
		opt0 := data.Vsphere_datacenter.Dc.Id
		opt1 := "esxi1/Resources"
		_, err := vsphere.LookupResourcePool(ctx, &GetResourcePoolArgs{
			DatacenterId: &opt0,
			Name:         &opt1,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_vsphere as vsphere

pool = vsphere.get_resource_pool(datacenter_id=data["vsphere_datacenter"]["dc"]["id"],
    name="esxi1/Resources")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const pool = vsphere_datacenter_dc.id.apply(id => vsphere.getResourcePool({
    datacenterId: id,
    name: "esxi1/Resources",
}));

Coming soon!

Using getResourcePool

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 getResourcePool(args: GetResourcePoolArgs, opts?: InvokeOptions): Promise<GetResourcePoolResult>
function getResourcePoolOutput(args: GetResourcePoolOutputArgs, opts?: InvokeOptions): Output<GetResourcePoolResult>
def get_resource_pool(datacenter_id: Optional[str] = None,
                      name: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetResourcePoolResult
def get_resource_pool_output(datacenter_id: Optional[pulumi.Input[str]] = None,
                      name: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetResourcePoolResult]
func LookupResourcePool(ctx *Context, args *LookupResourcePoolArgs, opts ...InvokeOption) (*LookupResourcePoolResult, error)
func LookupResourcePoolOutput(ctx *Context, args *LookupResourcePoolOutputArgs, opts ...InvokeOption) LookupResourcePoolResultOutput

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

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

The following arguments are supported:

DatacenterId string

The managed object reference ID of the datacenter the resource pool 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 of the resource pool. This can be a name or path. This is required when using vCenter.

DatacenterId string

The managed object reference ID of the datacenter the resource pool 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 of the resource pool. This can be a name or path. This is required when using vCenter.

datacenterId String

The managed object reference ID of the datacenter the resource pool 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 of the resource pool. This can be a name or path. This is required when using vCenter.

datacenterId string

The managed object reference ID of the datacenter the resource pool 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 of the resource pool. This can be a name or path. This is required when using vCenter.

datacenter_id str

The managed object reference ID of the datacenter the resource pool 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 of the resource pool. This can be a name or path. This is required when using vCenter.

datacenterId String

The managed object reference ID of the datacenter the resource pool 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 of the resource pool. This can be a name or path. This is required when using vCenter.

getResourcePool Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

DatacenterId string
Name string
Id string

The provider-assigned unique ID for this managed resource.

DatacenterId string
Name string
id String

The provider-assigned unique ID for this managed resource.

datacenterId String
name String
id string

The provider-assigned unique ID for this managed resource.

datacenterId string
name string
id str

The provider-assigned unique ID for this managed resource.

datacenter_id str
name str
id String

The provider-assigned unique ID for this managed resource.

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