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/v2/go/vsphere"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
opt0 := "dc1"
datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
Name: &opt0,
}, nil)
if err != nil {
return err
}
opt1 := datacenter.Id
opt2 := "resource-pool-1"
_, err = vsphere.LookupResourcePool(ctx, &vsphere.LookupResourcePoolArgs{
DatacenterId: &opt1,
Name: &opt2,
}, nil)
if err != nil {
return err
}
return nil
})
}
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",
}, { async: true }));
const pool = datacenter.apply(datacenter => vsphere.getResourcePool({
datacenterId: datacenter.id,
name: "resource-pool-1",
}, { async: true }));
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/v2/go/vsphere"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
opt0 := data.Vsphere_datacenter.Dc.Id
opt1 := "esxi1/Resources"
_, err := vsphere.LookupResourcePool(ctx, &vsphere.LookupResourcePoolArgs{
DatacenterId: &opt0,
Name: &opt1,
}, nil)
if err != nil {
return err
}
return nil
})
}
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",
}, { async: true }));
Using getResourcePool
function getResourcePool(args: GetResourcePoolArgs, opts?: InvokeOptions): Promise<GetResourcePoolResult>
def get_resource_pool(datacenter_id: Optional[str] = None, name: Optional[str] = None, opts: Optional[InvokeOptions] = None) -> GetResourcePoolResult
func LookupResourcePool(ctx *Context, args *LookupResourcePoolArgs, opts ...InvokeOption) (*LookupResourcePoolResult, error)
Note: This function is named
LookupResourcePool
in the Go SDK.
public static class GetResourcePool {
public static Task<GetResourcePoolResult> InvokeAsync(GetResourcePoolArgs args, InvokeOptions? opts = null)
}
The following arguments are supported:
- Datacenter
Id 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 emptyvsphere.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 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 emptyvsphere.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 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 emptyvsphere.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 emptyvsphere.Datacenter
data source.- name str
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.
- Datacenter
Id string - Name string
- Id string
The provider-assigned unique ID for this managed resource.
- Datacenter
Id string - Name string
- id string
The provider-assigned unique ID for this managed resource.
- datacenter
Id string - name string
- id str
The provider-assigned unique ID for this managed resource.
- datacenter_
id str - name 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.