VmfsDatastore
The vsphere..VmfsDatastore resource can be used to create and manage VMFS
datastores on an ESXi host or a set of hosts. The resource supports using any
SCSI device that can generally be used in a datastore, such as local disks, or
disks presented to a host or multiple hosts over Fibre Channel or iSCSI.
Devices can be specified manually, or discovered using the
vsphere..getVmfsDisks data source.
Auto-Mounting of Datastores Within vCenter
Note that the current behaviour of this resource will auto-mount any created datastores to any other host within vCenter that has access to the same disk.
Example: You want to create a datastore with a iSCSI LUN that is visible on 3
hosts in a single vSphere cluster (esxi1, esxi2 and esxi3). When you
create the datastore on esxi1, the datastore will be automatically mounted on
esxi2 and esxi3, without the need to configure the resource on either of
those two hosts.
Future versions of this resource may allow you to control the hosts that a datastore is mounted to, but currently, this automatic behaviour cannot be changed, so keep this in mind when writing your configurations and deploying your disks.
Increasing Datastore Size
To increase the size of a datastore, you must add additional disks to the
disks attribute. Expanding the size of a datastore by increasing the size of
an already provisioned disk is currently not supported (but may be in future
versions of this resource).
NOTE: You cannot decrease the size of a datastore. If the resource detects disks removed from the configuration, the provider will give an error.
Example Usage
Addition of local disks on a single host
using Pulumi;
using VSphere = Pulumi.VSphere;
class MyStack : Stack
{
public MyStack()
{
var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync());
var esxiHost = datacenter.Apply(datacenter => Output.Create(VSphere.GetHost.InvokeAsync(new VSphere.GetHostArgs
{
DatacenterId = datacenter.Id,
})));
var datastore = new VSphere.VmfsDatastore("datastore", new VSphere.VmfsDatastoreArgs
{
Disks =
{
"mpx.vmhba1:C0:T1:L0",
"mpx.vmhba1:C0:T2:L0",
"mpx.vmhba1:C0:T2:L0",
},
HostSystemId = esxiHost.Apply(esxiHost => esxiHost.Id),
});
}
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
datacenter = vsphere.get_datacenter()
esxi_host = vsphere.get_host(datacenter_id=datacenter.id)
datastore = vsphere.VmfsDatastore("datastore",
disks=[
"mpx.vmhba1:C0:T1:L0",
"mpx.vmhba1:C0:T2:L0",
"mpx.vmhba1:C0:T2:L0",
],
host_system_id=esxi_host.id)import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const datacenter = pulumi.output(vsphere.getDatacenter({ async: true }));
const esxiHost = datacenter.apply(datacenter => vsphere.getHost({
datacenterId: datacenter.id,
}, { async: true }));
const datastore = new vsphere.VmfsDatastore("datastore", {
disks: [
"mpx.vmhba1:C0:T1:L0",
"mpx.vmhba1:C0:T2:L0",
"mpx.vmhba1:C0:T2:L0",
],
hostSystemId: esxiHost.id,
});Auto-detection of disks via vsphere..getVmfsDisks
using Pulumi;
using VSphere = Pulumi.VSphere;
class MyStack : Stack
{
public MyStack()
{
var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
{
Name = "dc1",
}));
var esxiHost = datacenter.Apply(datacenter => Output.Create(VSphere.GetHost.InvokeAsync(new VSphere.GetHostArgs
{
DatacenterId = datacenter.Id,
Name = "esxi1",
})));
var available = esxiHost.Apply(esxiHost => Output.Create(VSphere.GetVmfsDisks.InvokeAsync(new VSphere.GetVmfsDisksArgs
{
Filter = "naa.60a98000",
HostSystemId = esxiHost.Id,
Rescan = true,
})));
var datastore = new VSphere.VmfsDatastore("datastore", new VSphere.VmfsDatastoreArgs
{
Disks = available.Apply(available => available.Disks),
Folder = "datastore-folder",
HostSystemId = esxiHost.Apply(esxiHost => esxiHost.Id),
});
}
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
datacenter = vsphere.get_datacenter(name="dc1")
esxi_host = vsphere.get_host(datacenter_id=datacenter.id,
name="esxi1")
available = vsphere.get_vmfs_disks(filter="naa.60a98000",
host_system_id=esxi_host.id,
rescan=True)
datastore = vsphere.VmfsDatastore("datastore",
disks=available.disks,
folder="datastore-folder",
host_system_id=esxi_host.id)import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const datacenter = pulumi.output(vsphere.getDatacenter({
name: "dc1",
}, { async: true }));
const esxiHost = datacenter.apply(datacenter => vsphere.getHost({
datacenterId: datacenter.id,
name: "esxi1",
}, { async: true }));
const available = esxiHost.apply(esxiHost => vsphere.getVmfsDisks({
filter: "naa.60a98000",
hostSystemId: esxiHost.id,
rescan: true,
}, { async: true }));
const datastore = new vsphere.VmfsDatastore("datastore", {
disks: available.disks,
folder: "datastore-folder",
hostSystemId: esxiHost.id,
});Create a VmfsDatastore Resource
new VmfsDatastore(name: string, args: VmfsDatastoreArgs, opts?: CustomResourceOptions);def VmfsDatastore(resource_name, opts=None, custom_attributes=None, datastore_cluster_id=None, disks=None, folder=None, host_system_id=None, name=None, tags=None, __props__=None);func NewVmfsDatastore(ctx *Context, name string, args VmfsDatastoreArgs, opts ...ResourceOption) (*VmfsDatastore, error)public VmfsDatastore(string name, VmfsDatastoreArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args VmfsDatastoreArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args VmfsDatastoreArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VmfsDatastoreArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
VmfsDatastore Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The VmfsDatastore resource accepts the following input properties:
- Disks List<string>
The disks to use with the datastore.
- Host
System stringId The managed object ID of the host to set the datastore up on. Note that this is not necessarily the only host that the datastore will be set up on - see here for more info. Forces a new resource if changed.
- Custom
Attributes Dictionary<string, string> Map of custom attribute ids to attribute value string to set on datastore resource.
- Datastore
Cluster stringId The managed object ID of a datastore cluster to put this datastore in. Conflicts with
folder.- Folder string
The relative path to a folder to put this datastore in. This is a path relative to the datacenter you are deploying the datastore to. Example: for the
dc1datacenter, and a providedfolderoffoo/bar, The provider will place a datastore namedtestin a datastore folder located at/dc1/datastore/foo/bar, with the final inventory path being/dc1/datastore/foo/bar/test. Conflicts withdatastore_cluster_id.- Name string
The name of the datastore. Forces a new resource if changed.
- List<string>
The IDs of any tags to attach to this resource.
- Disks []string
The disks to use with the datastore.
- Host
System stringId The managed object ID of the host to set the datastore up on. Note that this is not necessarily the only host that the datastore will be set up on - see here for more info. Forces a new resource if changed.
- Custom
Attributes map[string]string Map of custom attribute ids to attribute value string to set on datastore resource.
- Datastore
Cluster stringId The managed object ID of a datastore cluster to put this datastore in. Conflicts with
folder.- Folder string
The relative path to a folder to put this datastore in. This is a path relative to the datacenter you are deploying the datastore to. Example: for the
dc1datacenter, and a providedfolderoffoo/bar, The provider will place a datastore namedtestin a datastore folder located at/dc1/datastore/foo/bar, with the final inventory path being/dc1/datastore/foo/bar/test. Conflicts withdatastore_cluster_id.- Name string
The name of the datastore. Forces a new resource if changed.
- []string
The IDs of any tags to attach to this resource.
- disks string[]
The disks to use with the datastore.
- host
System stringId The managed object ID of the host to set the datastore up on. Note that this is not necessarily the only host that the datastore will be set up on - see here for more info. Forces a new resource if changed.
- custom
Attributes {[key: string]: string} Map of custom attribute ids to attribute value string to set on datastore resource.
- datastore
Cluster stringId The managed object ID of a datastore cluster to put this datastore in. Conflicts with
folder.- folder string
The relative path to a folder to put this datastore in. This is a path relative to the datacenter you are deploying the datastore to. Example: for the
dc1datacenter, and a providedfolderoffoo/bar, The provider will place a datastore namedtestin a datastore folder located at/dc1/datastore/foo/bar, with the final inventory path being/dc1/datastore/foo/bar/test. Conflicts withdatastore_cluster_id.- name string
The name of the datastore. Forces a new resource if changed.
- string[]
The IDs of any tags to attach to this resource.
- disks List[str]
The disks to use with the datastore.
- host_
system_ strid The managed object ID of the host to set the datastore up on. Note that this is not necessarily the only host that the datastore will be set up on - see here for more info. Forces a new resource if changed.
- custom_
attributes Dict[str, str] Map of custom attribute ids to attribute value string to set on datastore resource.
- datastore_
cluster_ strid The managed object ID of a datastore cluster to put this datastore in. Conflicts with
folder.- folder str
The relative path to a folder to put this datastore in. This is a path relative to the datacenter you are deploying the datastore to. Example: for the
dc1datacenter, and a providedfolderoffoo/bar, The provider will place a datastore namedtestin a datastore folder located at/dc1/datastore/foo/bar, with the final inventory path being/dc1/datastore/foo/bar/test. Conflicts withdatastore_cluster_id.- name str
The name of the datastore. Forces a new resource if changed.
- List[str]
The IDs of any tags to attach to this resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the VmfsDatastore resource produces the following output properties:
- Accessible bool
The connectivity status of the datastore. If this is
false, some other computed attributes may be out of date.- Capacity int
Maximum capacity of the datastore, in megabytes.
- Free
Space int Available space of this datastore, in megabytes.
- Id string
- The provider-assigned unique ID for this managed resource.
- Maintenance
Mode string The current maintenance mode state of the datastore.
- Multiple
Host boolAccess If
true, more than one host in the datacenter has been configured with access to the datastore.- Uncommitted
Space int Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
- Url string
The unique locator for the datastore.
- Accessible bool
The connectivity status of the datastore. If this is
false, some other computed attributes may be out of date.- Capacity int
Maximum capacity of the datastore, in megabytes.
- Free
Space int Available space of this datastore, in megabytes.
- Id string
- The provider-assigned unique ID for this managed resource.
- Maintenance
Mode string The current maintenance mode state of the datastore.
- Multiple
Host boolAccess If
true, more than one host in the datacenter has been configured with access to the datastore.- Uncommitted
Space int Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
- Url string
The unique locator for the datastore.
- accessible boolean
The connectivity status of the datastore. If this is
false, some other computed attributes may be out of date.- capacity number
Maximum capacity of the datastore, in megabytes.
- free
Space number Available space of this datastore, in megabytes.
- id string
- The provider-assigned unique ID for this managed resource.
- maintenance
Mode string The current maintenance mode state of the datastore.
- multiple
Host booleanAccess If
true, more than one host in the datacenter has been configured with access to the datastore.- uncommitted
Space number Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
- url string
The unique locator for the datastore.
- accessible bool
The connectivity status of the datastore. If this is
false, some other computed attributes may be out of date.- capacity float
Maximum capacity of the datastore, in megabytes.
- free_
space float Available space of this datastore, in megabytes.
- id str
- The provider-assigned unique ID for this managed resource.
- maintenance_
mode str The current maintenance mode state of the datastore.
- multiple_
host_ boolaccess If
true, more than one host in the datacenter has been configured with access to the datastore.- uncommitted_
space float Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
- url str
The unique locator for the datastore.
Look up an Existing VmfsDatastore Resource
Get an existing VmfsDatastore resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: VmfsDatastoreState, opts?: CustomResourceOptions): VmfsDatastorestatic get(resource_name, id, opts=None, accessible=None, capacity=None, custom_attributes=None, datastore_cluster_id=None, disks=None, folder=None, free_space=None, host_system_id=None, maintenance_mode=None, multiple_host_access=None, name=None, tags=None, uncommitted_space=None, url=None, __props__=None);func GetVmfsDatastore(ctx *Context, name string, id IDInput, state *VmfsDatastoreState, opts ...ResourceOption) (*VmfsDatastore, error)public static VmfsDatastore Get(string name, Input<string> id, VmfsDatastoreState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Accessible bool
The connectivity status of the datastore. If this is
false, some other computed attributes may be out of date.- Capacity int
Maximum capacity of the datastore, in megabytes.
- Custom
Attributes Dictionary<string, string> Map of custom attribute ids to attribute value string to set on datastore resource.
- Datastore
Cluster stringId The managed object ID of a datastore cluster to put this datastore in. Conflicts with
folder.- Disks List<string>
The disks to use with the datastore.
- Folder string
The relative path to a folder to put this datastore in. This is a path relative to the datacenter you are deploying the datastore to. Example: for the
dc1datacenter, and a providedfolderoffoo/bar, The provider will place a datastore namedtestin a datastore folder located at/dc1/datastore/foo/bar, with the final inventory path being/dc1/datastore/foo/bar/test. Conflicts withdatastore_cluster_id.- Free
Space int Available space of this datastore, in megabytes.
- Host
System stringId The managed object ID of the host to set the datastore up on. Note that this is not necessarily the only host that the datastore will be set up on - see here for more info. Forces a new resource if changed.
- Maintenance
Mode string The current maintenance mode state of the datastore.
- Multiple
Host boolAccess If
true, more than one host in the datacenter has been configured with access to the datastore.- Name string
The name of the datastore. Forces a new resource if changed.
- List<string>
The IDs of any tags to attach to this resource.
- Uncommitted
Space int Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
- Url string
The unique locator for the datastore.
- Accessible bool
The connectivity status of the datastore. If this is
false, some other computed attributes may be out of date.- Capacity int
Maximum capacity of the datastore, in megabytes.
- Custom
Attributes map[string]string Map of custom attribute ids to attribute value string to set on datastore resource.
- Datastore
Cluster stringId The managed object ID of a datastore cluster to put this datastore in. Conflicts with
folder.- Disks []string
The disks to use with the datastore.
- Folder string
The relative path to a folder to put this datastore in. This is a path relative to the datacenter you are deploying the datastore to. Example: for the
dc1datacenter, and a providedfolderoffoo/bar, The provider will place a datastore namedtestin a datastore folder located at/dc1/datastore/foo/bar, with the final inventory path being/dc1/datastore/foo/bar/test. Conflicts withdatastore_cluster_id.- Free
Space int Available space of this datastore, in megabytes.
- Host
System stringId The managed object ID of the host to set the datastore up on. Note that this is not necessarily the only host that the datastore will be set up on - see here for more info. Forces a new resource if changed.
- Maintenance
Mode string The current maintenance mode state of the datastore.
- Multiple
Host boolAccess If
true, more than one host in the datacenter has been configured with access to the datastore.- Name string
The name of the datastore. Forces a new resource if changed.
- []string
The IDs of any tags to attach to this resource.
- Uncommitted
Space int Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
- Url string
The unique locator for the datastore.
- accessible boolean
The connectivity status of the datastore. If this is
false, some other computed attributes may be out of date.- capacity number
Maximum capacity of the datastore, in megabytes.
- custom
Attributes {[key: string]: string} Map of custom attribute ids to attribute value string to set on datastore resource.
- datastore
Cluster stringId The managed object ID of a datastore cluster to put this datastore in. Conflicts with
folder.- disks string[]
The disks to use with the datastore.
- folder string
The relative path to a folder to put this datastore in. This is a path relative to the datacenter you are deploying the datastore to. Example: for the
dc1datacenter, and a providedfolderoffoo/bar, The provider will place a datastore namedtestin a datastore folder located at/dc1/datastore/foo/bar, with the final inventory path being/dc1/datastore/foo/bar/test. Conflicts withdatastore_cluster_id.- free
Space number Available space of this datastore, in megabytes.
- host
System stringId The managed object ID of the host to set the datastore up on. Note that this is not necessarily the only host that the datastore will be set up on - see here for more info. Forces a new resource if changed.
- maintenance
Mode string The current maintenance mode state of the datastore.
- multiple
Host booleanAccess If
true, more than one host in the datacenter has been configured with access to the datastore.- name string
The name of the datastore. Forces a new resource if changed.
- string[]
The IDs of any tags to attach to this resource.
- uncommitted
Space number Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
- url string
The unique locator for the datastore.
- accessible bool
The connectivity status of the datastore. If this is
false, some other computed attributes may be out of date.- capacity float
Maximum capacity of the datastore, in megabytes.
- custom_
attributes Dict[str, str] Map of custom attribute ids to attribute value string to set on datastore resource.
- datastore_
cluster_ strid The managed object ID of a datastore cluster to put this datastore in. Conflicts with
folder.- disks List[str]
The disks to use with the datastore.
- folder str
The relative path to a folder to put this datastore in. This is a path relative to the datacenter you are deploying the datastore to. Example: for the
dc1datacenter, and a providedfolderoffoo/bar, The provider will place a datastore namedtestin a datastore folder located at/dc1/datastore/foo/bar, with the final inventory path being/dc1/datastore/foo/bar/test. Conflicts withdatastore_cluster_id.- free_
space float Available space of this datastore, in megabytes.
- host_
system_ strid The managed object ID of the host to set the datastore up on. Note that this is not necessarily the only host that the datastore will be set up on - see here for more info. Forces a new resource if changed.
- maintenance_
mode str The current maintenance mode state of the datastore.
- multiple_
host_ boolaccess If
true, more than one host in the datacenter has been configured with access to the datastore.- name str
The name of the datastore. Forces a new resource if changed.
- List[str]
The IDs of any tags to attach to this resource.
- uncommitted_
space float Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
- url str
The unique locator for the datastore.
Package Details
- Repository
- https://github.com/pulumi/pulumi-vsphere
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vsphereTerraform Provider.