» vsphere_datacenter

Provides a VMware vSphere datacenter resource. This can be used as the primary container of inventory objects such as hosts and virtual machines.

» Example Usages

Create datacenter on the root folder:

resource "vsphere_datacenter" "prod_datacenter" {
  name       = "my_prod_datacenter"
}

Create datacenter on a subfolder:

resource "vsphere_datacenter" "research_datacenter" {
  name       = "my_research_datacenter"
  folder     = "/research/"
}

» Argument Reference

The following arguments are supported:

  • name - (Required) The name of the datacenter. This name needs to be unique within the folder. Forces a new resource if changed.
  • folder - (Optional) The folder where the datacenter should be created. Forces a new resource if changed.
  • tags - (Optional) The IDs of any tags to attach to this resource. See here for a reference on how to apply tags.
  • custom_attributes - (Optional) Map of custom attribute ids to value strings to set for datacenter resource. See here for a reference on how to set values for custom attributes.

» Attribute Reference

» Importing

An existing datacenter can be imported into this resource via supplying the full path to the datacenter. An example is below:

terraform import vsphere_datacenter.dc /dc1

The above would import the datacenter named dc1.