1. Packages
  2. Vsphere Provider
  3. API Docs
  4. VmfsDatastore
vSphere v4.13.2 published on Wednesday, Apr 9, 2025 by Pulumi

vsphere.VmfsDatastore

Explore with Pulumi AI

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

The following example uses the default datacenter and default host to add a datastore with local disks to a single ESXi server.

NOTE: There are some situations where datastore creation will not work when working through vCenter (usually when trying to create a datastore on a single host with local disks). If you experience trouble creating the datastore you need through vCenter, break the datastore off into a different configuration and deploy it using the ESXi server as the provider endpoint, using a similar configuration to what is below.

import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const datacenter = vsphere.getDatacenter({});
const host = datacenter.then(datacenter => vsphere.getHost({
    datacenterId: datacenter.id,
}));
const datastore = new vsphere.VmfsDatastore("datastore", {
    name: "test",
    hostSystemId: esxiHost.id,
    disks: [
        "mpx.vmhba1:C0:T1:L0",
        "mpx.vmhba1:C0:T2:L0",
        "mpx.vmhba1:C0:T2:L0",
    ],
});
Copy
import pulumi
import pulumi_vsphere as vsphere

datacenter = vsphere.get_datacenter()
host = vsphere.get_host(datacenter_id=datacenter.id)
datastore = vsphere.VmfsDatastore("datastore",
    name="test",
    host_system_id=esxi_host["id"],
    disks=[
        "mpx.vmhba1:C0:T1:L0",
        "mpx.vmhba1:C0:T2:L0",
        "mpx.vmhba1:C0:T2:L0",
    ])
Copy
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{}, nil)
		if err != nil {
			return err
		}
		_, err = vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{
			DatacenterId: datacenter.Id,
		}, nil)
		if err != nil {
			return err
		}
		_, err = vsphere.NewVmfsDatastore(ctx, "datastore", &vsphere.VmfsDatastoreArgs{
			Name:         pulumi.String("test"),
			HostSystemId: pulumi.Any(esxiHost.Id),
			Disks: pulumi.StringArray{
				pulumi.String("mpx.vmhba1:C0:T1:L0"),
				pulumi.String("mpx.vmhba1:C0:T2:L0"),
				pulumi.String("mpx.vmhba1:C0:T2:L0"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using VSphere = Pulumi.VSphere;

return await Deployment.RunAsync(() => 
{
    var datacenter = VSphere.GetDatacenter.Invoke();

    var host = VSphere.GetHost.Invoke(new()
    {
        DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
    });

    var datastore = new VSphere.VmfsDatastore("datastore", new()
    {
        Name = "test",
        HostSystemId = esxiHost.Id,
        Disks = new[]
        {
            "mpx.vmhba1:C0:T1:L0",
            "mpx.vmhba1:C0:T2:L0",
            "mpx.vmhba1:C0:T2:L0",
        },
    });

});
Copy
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.GetHostArgs;
import com.pulumi.vsphere.VmfsDatastore;
import com.pulumi.vsphere.VmfsDatastoreArgs;
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()
            .build());

        final var host = VsphereFunctions.getHost(GetHostArgs.builder()
            .datacenterId(datacenter.id())
            .build());

        var datastore = new VmfsDatastore("datastore", VmfsDatastoreArgs.builder()
            .name("test")
            .hostSystemId(esxiHost.id())
            .disks(            
                "mpx.vmhba1:C0:T1:L0",
                "mpx.vmhba1:C0:T2:L0",
                "mpx.vmhba1:C0:T2:L0")
            .build());

    }
}
Copy
resources:
  datastore:
    type: vsphere:VmfsDatastore
    properties:
      name: test
      hostSystemId: ${esxiHost.id}
      disks:
        - mpx.vmhba1:C0:T1:L0
        - mpx.vmhba1:C0:T2:L0
        - mpx.vmhba1:C0:T2:L0
variables:
  datacenter:
    fn::invoke:
      function: vsphere:getDatacenter
      arguments: {}
  host:
    fn::invoke:
      function: vsphere:getHost
      arguments:
        datacenterId: ${datacenter.id}
Copy

Auto-detection of disks via vsphere.getVmfsDisks

The following example makes use of the vsphere.getVmfsDisks data source to auto-detect exported iSCSI LUNS matching a certain NAA vendor ID (in this case, LUNs exported from a NetApp). These discovered disks are then loaded into vsphere.VmfsDatastore. The datastore is also placed in the datastore-folder folder afterwards.

import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const datacenter = vsphere.getDatacenter({
    name: "dc-01",
});
const host = datacenter.then(datacenter => vsphere.getHost({
    name: "esxi-01.example.com",
    datacenterId: datacenter.id,
}));
const available = host.then(host => vsphere.getVmfsDisks({
    hostSystemId: host.id,
    rescan: true,
    filter: "naa.60a98000",
}));
const datastore = new vsphere.VmfsDatastore("datastore", {
    name: "test",
    hostSystemId: esxiHost.id,
    folder: "datastore-folder",
    disks: [available.then(available => available.disks)],
});
Copy
import pulumi
import pulumi_vsphere as vsphere

datacenter = vsphere.get_datacenter(name="dc-01")
host = vsphere.get_host(name="esxi-01.example.com",
    datacenter_id=datacenter.id)
available = vsphere.get_vmfs_disks(host_system_id=host.id,
    rescan=True,
    filter="naa.60a98000")
datastore = vsphere.VmfsDatastore("datastore",
    name="test",
    host_system_id=esxi_host["id"],
    folder="datastore-folder",
    disks=[available.disks])
Copy
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
		}
		host, err := vsphere.LookupHost(ctx, &vsphere.LookupHostArgs{
			Name:         pulumi.StringRef("esxi-01.example.com"),
			DatacenterId: datacenter.Id,
		}, nil)
		if err != nil {
			return err
		}
		available, err := vsphere.GetVmfsDisks(ctx, &vsphere.GetVmfsDisksArgs{
			HostSystemId: host.Id,
			Rescan:       pulumi.BoolRef(true),
			Filter:       pulumi.StringRef("naa.60a98000"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = vsphere.NewVmfsDatastore(ctx, "datastore", &vsphere.VmfsDatastoreArgs{
			Name:         pulumi.String("test"),
			HostSystemId: pulumi.Any(esxiHost.Id),
			Folder:       pulumi.String("datastore-folder"),
			Disks: pulumi.StringArray{
				interface{}(available.Disks),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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 host = VSphere.GetHost.Invoke(new()
    {
        Name = "esxi-01.example.com",
        DatacenterId = datacenter.Apply(getDatacenterResult => getDatacenterResult.Id),
    });

    var available = VSphere.GetVmfsDisks.Invoke(new()
    {
        HostSystemId = host.Apply(getHostResult => getHostResult.Id),
        Rescan = true,
        Filter = "naa.60a98000",
    });

    var datastore = new VSphere.VmfsDatastore("datastore", new()
    {
        Name = "test",
        HostSystemId = esxiHost.Id,
        Folder = "datastore-folder",
        Disks = new[]
        {
            available.Apply(getVmfsDisksResult => getVmfsDisksResult.Disks),
        },
    });

});
Copy
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.GetHostArgs;
import com.pulumi.vsphere.inputs.GetVmfsDisksArgs;
import com.pulumi.vsphere.VmfsDatastore;
import com.pulumi.vsphere.VmfsDatastoreArgs;
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 host = VsphereFunctions.getHost(GetHostArgs.builder()
            .name("esxi-01.example.com")
            .datacenterId(datacenter.id())
            .build());

        final var available = VsphereFunctions.getVmfsDisks(GetVmfsDisksArgs.builder()
            .hostSystemId(host.id())
            .rescan(true)
            .filter("naa.60a98000")
            .build());

        var datastore = new VmfsDatastore("datastore", VmfsDatastoreArgs.builder()
            .name("test")
            .hostSystemId(esxiHost.id())
            .folder("datastore-folder")
            .disks(available.disks())
            .build());

    }
}
Copy
resources:
  datastore:
    type: vsphere:VmfsDatastore
    properties:
      name: test
      hostSystemId: ${esxiHost.id}
      folder: datastore-folder
      disks:
        - ${available.disks}
variables:
  datacenter:
    fn::invoke:
      function: vsphere:getDatacenter
      arguments:
        name: dc-01
  host:
    fn::invoke:
      function: vsphere:getHost
      arguments:
        name: esxi-01.example.com
        datacenterId: ${datacenter.id}
  available:
    fn::invoke:
      function: vsphere:getVmfsDisks
      arguments:
        hostSystemId: ${host.id}
        rescan: true
        filter: naa.60a98000
Copy

Create VmfsDatastore Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new VmfsDatastore(name: string, args: VmfsDatastoreArgs, opts?: CustomResourceOptions);
@overload
def VmfsDatastore(resource_name: str,
                  args: VmfsDatastoreArgs,
                  opts: Optional[ResourceOptions] = None)

@overload
def VmfsDatastore(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  disks: Optional[Sequence[str]] = None,
                  host_system_id: Optional[str] = None,
                  custom_attributes: Optional[Mapping[str, str]] = None,
                  datastore_cluster_id: Optional[str] = None,
                  folder: Optional[str] = None,
                  name: Optional[str] = None,
                  tags: Optional[Sequence[str]] = None)
func NewVmfsDatastore(ctx *Context, name string, args VmfsDatastoreArgs, opts ...ResourceOption) (*VmfsDatastore, error)
public VmfsDatastore(string name, VmfsDatastoreArgs args, CustomResourceOptions? opts = null)
public VmfsDatastore(String name, VmfsDatastoreArgs args)
public VmfsDatastore(String name, VmfsDatastoreArgs args, CustomResourceOptions options)
type: vsphere:VmfsDatastore
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. VmfsDatastoreArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. VmfsDatastoreArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. VmfsDatastoreArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. VmfsDatastoreArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. VmfsDatastoreArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var vmfsDatastoreResource = new VSphere.VmfsDatastore("vmfsDatastoreResource", new()
{
    Disks = new[]
    {
        "string",
    },
    HostSystemId = "string",
    CustomAttributes = 
    {
        { "string", "string" },
    },
    DatastoreClusterId = "string",
    Folder = "string",
    Name = "string",
    Tags = new[]
    {
        "string",
    },
});
Copy
example, err := vsphere.NewVmfsDatastore(ctx, "vmfsDatastoreResource", &vsphere.VmfsDatastoreArgs{
	Disks: pulumi.StringArray{
		pulumi.String("string"),
	},
	HostSystemId: pulumi.String("string"),
	CustomAttributes: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	DatastoreClusterId: pulumi.String("string"),
	Folder:             pulumi.String("string"),
	Name:               pulumi.String("string"),
	Tags: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var vmfsDatastoreResource = new VmfsDatastore("vmfsDatastoreResource", VmfsDatastoreArgs.builder()
    .disks("string")
    .hostSystemId("string")
    .customAttributes(Map.of("string", "string"))
    .datastoreClusterId("string")
    .folder("string")
    .name("string")
    .tags("string")
    .build());
Copy
vmfs_datastore_resource = vsphere.VmfsDatastore("vmfsDatastoreResource",
    disks=["string"],
    host_system_id="string",
    custom_attributes={
        "string": "string",
    },
    datastore_cluster_id="string",
    folder="string",
    name="string",
    tags=["string"])
Copy
const vmfsDatastoreResource = new vsphere.VmfsDatastore("vmfsDatastoreResource", {
    disks: ["string"],
    hostSystemId: "string",
    customAttributes: {
        string: "string",
    },
    datastoreClusterId: "string",
    folder: "string",
    name: "string",
    tags: ["string"],
});
Copy
type: vsphere:VmfsDatastore
properties:
    customAttributes:
        string: string
    datastoreClusterId: string
    disks:
        - string
    folder: string
    hostSystemId: string
    name: string
    tags:
        - string
Copy

VmfsDatastore Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The VmfsDatastore resource accepts the following input properties:

Disks This property is required. List<string>
The disks to use with the datastore.
HostSystemId
This property is required.
Changes to this property will trigger replacement.
string
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.
CustomAttributes Dictionary<string, string>

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

DatastoreClusterId string
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
Name string
The name of the datastore. Forces a new resource if changed.
Tags List<string>

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

Disks This property is required. []string
The disks to use with the datastore.
HostSystemId
This property is required.
Changes to this property will trigger replacement.
string
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.
CustomAttributes map[string]string

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

DatastoreClusterId string
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
Name string
The name of the datastore. Forces a new resource if changed.
Tags []string

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

disks This property is required. List<String>
The disks to use with the datastore.
hostSystemId
This property is required.
Changes to this property will trigger replacement.
String
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.
customAttributes Map<String,String>

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datastoreClusterId String
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
name String
The name of the datastore. Forces a new resource if changed.
tags List<String>

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

disks This property is required. string[]
The disks to use with the datastore.
hostSystemId
This property is required.
Changes to this property will trigger replacement.
string
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.
customAttributes {[key: string]: string}

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datastoreClusterId string
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
name string
The name of the datastore. Forces a new resource if changed.
tags string[]

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

disks This property is required. Sequence[str]
The disks to use with the datastore.
host_system_id
This property is required.
Changes to this property will trigger replacement.
str
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 Mapping[str, str]

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datastore_cluster_id str
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
name str
The name of the datastore. Forces a new resource if changed.
tags Sequence[str]

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

disks This property is required. List<String>
The disks to use with the datastore.
hostSystemId
This property is required.
Changes to this property will trigger replacement.
String
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.
customAttributes Map<String>

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datastoreClusterId String
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
name String
The name of the datastore. Forces a new resource if changed.
tags List<String>

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

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.
FreeSpace int
Available space of this datastore, in megabytes.
Id string
The provider-assigned unique ID for this managed resource.
MaintenanceMode string
The current maintenance mode state of the datastore.
MultipleHostAccess bool
If true, more than one host in the datacenter has been configured with access to the datastore.
UncommittedSpace 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.
FreeSpace int
Available space of this datastore, in megabytes.
Id string
The provider-assigned unique ID for this managed resource.
MaintenanceMode string
The current maintenance mode state of the datastore.
MultipleHostAccess bool
If true, more than one host in the datacenter has been configured with access to the datastore.
UncommittedSpace 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 Integer
Maximum capacity of the datastore, in megabytes.
freeSpace Integer
Available space of this datastore, in megabytes.
id String
The provider-assigned unique ID for this managed resource.
maintenanceMode String
The current maintenance mode state of the datastore.
multipleHostAccess Boolean
If true, more than one host in the datacenter has been configured with access to the datastore.
uncommittedSpace Integer
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.
freeSpace number
Available space of this datastore, in megabytes.
id string
The provider-assigned unique ID for this managed resource.
maintenanceMode string
The current maintenance mode state of the datastore.
multipleHostAccess boolean
If true, more than one host in the datacenter has been configured with access to the datastore.
uncommittedSpace 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 int
Maximum capacity of the datastore, in megabytes.
free_space int
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_access bool
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 str
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.
freeSpace Number
Available space of this datastore, in megabytes.
id String
The provider-assigned unique ID for this managed resource.
maintenanceMode String
The current maintenance mode state of the datastore.
multipleHostAccess Boolean
If true, more than one host in the datacenter has been configured with access to the datastore.
uncommittedSpace Number
Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
url String
The unique locator for the datastore.

Look up 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): VmfsDatastore
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        accessible: Optional[bool] = None,
        capacity: Optional[int] = None,
        custom_attributes: Optional[Mapping[str, str]] = None,
        datastore_cluster_id: Optional[str] = None,
        disks: Optional[Sequence[str]] = None,
        folder: Optional[str] = None,
        free_space: Optional[int] = None,
        host_system_id: Optional[str] = None,
        maintenance_mode: Optional[str] = None,
        multiple_host_access: Optional[bool] = None,
        name: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        uncommitted_space: Optional[int] = None,
        url: Optional[str] = None) -> VmfsDatastore
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)
public static VmfsDatastore get(String name, Output<String> id, VmfsDatastoreState state, CustomResourceOptions options)
resources:  _:    type: vsphere:VmfsDatastore    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
CustomAttributes Dictionary<string, string>

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

DatastoreClusterId string
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
FreeSpace int
Available space of this datastore, in megabytes.
HostSystemId Changes to this property will trigger replacement. string
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.
MaintenanceMode string
The current maintenance mode state of the datastore.
MultipleHostAccess bool
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.
Tags List<string>

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

UncommittedSpace 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.
CustomAttributes map[string]string

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

DatastoreClusterId string
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
FreeSpace int
Available space of this datastore, in megabytes.
HostSystemId Changes to this property will trigger replacement. string
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.
MaintenanceMode string
The current maintenance mode state of the datastore.
MultipleHostAccess bool
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.
Tags []string

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

UncommittedSpace 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 Integer
Maximum capacity of the datastore, in megabytes.
customAttributes Map<String,String>

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datastoreClusterId String
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
freeSpace Integer
Available space of this datastore, in megabytes.
hostSystemId Changes to this property will trigger replacement. String
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.
maintenanceMode String
The current maintenance mode state of the datastore.
multipleHostAccess Boolean
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.
tags List<String>

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

uncommittedSpace Integer
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.
customAttributes {[key: string]: string}

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datastoreClusterId string
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
freeSpace number
Available space of this datastore, in megabytes.
hostSystemId Changes to this property will trigger replacement. string
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.
maintenanceMode string
The current maintenance mode state of the datastore.
multipleHostAccess boolean
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.
tags string[]

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

uncommittedSpace 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 int
Maximum capacity of the datastore, in megabytes.
custom_attributes Mapping[str, str]

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datastore_cluster_id str
The managed object ID of a datastore cluster to put this datastore in. Conflicts with folder.
disks Sequence[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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
free_space int
Available space of this datastore, in megabytes.
host_system_id Changes to this property will trigger replacement. str
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_access bool
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.
tags Sequence[str]

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

uncommitted_space int
Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
url str
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.
customAttributes Map<String>

Map of custom attribute ids to attribute value string to set on datastore resource.

NOTE: Custom attributes are unsupported on direct ESXi connections and require vCenter.

datastoreClusterId String
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 dc1 datacenter, and a provided folder of foo/bar, The provider will place a datastore named test in a datastore folder located at /dc1/datastore/foo/bar, with the final inventory path being /dc1/datastore/foo/bar/test. Conflicts with datastore_cluster_id.
freeSpace Number
Available space of this datastore, in megabytes.
hostSystemId Changes to this property will trigger replacement. String
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.
maintenanceMode String
The current maintenance mode state of the datastore.
multipleHostAccess Boolean
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.
tags List<String>

The IDs of any tags to attach to this resource.

NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

uncommittedSpace Number
Total additional storage space, in megabytes, potentially used by all virtual machines on this datastore.
url String
The unique locator for the datastore.

Import

An existing VMFS datastore can be imported into this resource

via its managed object ID, via the command below. You also need the host system

ID.

$ pulumi import vsphere:index/vmfsDatastore:VmfsDatastore datastore datastore-123:host-10
Copy

You need a tool like govc that can display managed object IDs.

In the case of govc, you can locate a managed object ID from an inventory path

by doing the following:

$ govc ls -i /dc/datastore/terraform-test

Datastore:datastore-123

To locate host IDs, it might be a good idea to supply the -l flag as well so

that you can line up the names with the IDs:

$ govc ls -l -i /dc/host/cluster1

ResourcePool:resgroup-10 /dc/host/cluster1/Resources

HostSystem:host-10 /dc/host/cluster1/esxi1

HostSystem:host-11 /dc/host/cluster1/esxi2

HostSystem:host-12 /dc/host/cluster1/esxi3

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
vSphere pulumi/pulumi-vsphere
License
Apache-2.0
Notes
This Pulumi package is based on the vsphere Terraform Provider.