W3cubDocs

/Terraform

vsphere_datastore

The vsphere_datastore 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_virtual_machine resource.

Example Usage

data "vsphere_datacenter" "datacenter" {
  name = "dc1"
}

data "vsphere_datastore" "datastore" {
  name          = "datastore1"
  datacenter_id = "${data.vsphere_datacenter.datacenter.id}"
}

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the datastore. This can be a name or path.
  • datacenter_id - (Optional) The managed object reference ID of the datacenter the datastore 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.

Attribute Reference

Currently, the only exported attribute from this data source is id, which represents the ID of the datastore that was looked up.

© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/vsphere/d/datastore.html