The vsphere_datacenter
data source can be used to discover the ID of a vSphere datacenter. This can then be used with resources or data sources that require a datacenter, such as the vsphere_host
data source.
data "vsphere_datacenter" "datacenter" { name = "dc1" }
The following arguments are supported:
name
- (Optional) The name of the datacenter. This can be a name or path. Can be omitted if there is only one datacenter in your inventory. NOTE: When used against ESXi, this data source always fetches the server's "default" datacenter, which is a special datacenter unrelated to the datacenters that exist in any vCenter server that might be managing this host. Hence, the
name
attribute is completely ignored.
The only exported attribute is id
, which is the managed object ID of this datacenter.
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/vsphere/d/datacenter.html