GetDatastore
The vsphere..getDatastore data source can be used to discover the ID of a
datastore in vSphere. This is useful to fetch the ID of a datastore 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 datastore = datacenter.Apply(datacenter => Output.Create(VSphere.GetDatastore.InvokeAsync(new VSphere.GetDatastoreArgs
{
DatacenterId = datacenter.Id,
Name = "datastore1",
})));
}
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
datacenter = vsphere.get_datacenter(name="dc1")
datastore = vsphere.get_datastore(datacenter_id=datacenter.id,
name="datastore1")import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const datacenter = pulumi.output(vsphere.getDatacenter({
name: "dc1",
}, { async: true }));
const datastore = datacenter.apply(datacenter => vsphere.getDatastore({
datacenterId: datacenter.id,
name: "datastore1",
}, { async: true }));Using GetDatastore
function getDatastore(args: GetDatastoreArgs, opts?: InvokeOptions): Promise<GetDatastoreResult>function get_datastore(datacenter_id=None, name=None, opts=None)func GetDatastore(ctx *Context, args *GetDatastoreArgs, opts ...InvokeOption) (*GetDatastoreResult, error)public static class GetDatastore {
public static Task<GetDatastoreResult> InvokeAsync(GetDatastoreArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Name string
The name of the datastore. This can be a name or path.
- Datacenter
Id string The managed object reference ID of the datacenter the datastore is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use the id attribute from an emptyvsphere..Datacenterdata source.
- Name string
The name of the datastore. This can be a name or path.
- Datacenter
Id string The managed object reference ID of the datacenter the datastore is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use the id attribute from an emptyvsphere..Datacenterdata source.
- name string
The name of the datastore. This can be a name or path.
- datacenter
Id string The managed object reference ID of the datacenter the datastore is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use the id attribute from an emptyvsphere..Datacenterdata source.
- name str
The name of the datastore. This can be a name or path.
- datacenter_
id str The managed object reference ID of the datacenter the datastore is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use the id attribute from an emptyvsphere..Datacenterdata source.
GetDatastore Result
The following output properties are available:
Package Details
- Repository
- https://github.com/pulumi/pulumi-vsphere
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vsphereTerraform Provider.