» vsphere_dpm_host_override

The vsphere_dpm_host_override resource can be used to add a DPM override to a cluster for a particular host. This allows you to control the power management settings for individual hosts in the cluster while leaving any unspecified ones at the default power management settings.

For more information on DPM within vSphere clusters, see this page.

» Example Usage

The following example creates a compute cluster comprised of three hosts, making use of the vsphere_compute_cluster resource. DPM will be disabled in the cluster as it is the default setting, but we override the setting of the first host referenced by the vsphere_host data source (esxi1) by using the vsphere_dpm_host_override resource so it will be powered off when the cluster does not need it to service virtual machines.

variable "datacenter" {
  default = "dc1"
}

variable "hosts" {
  default = [
    "esxi1",
    "esxi2",
    "esxi3",
  ]
}

data "vsphere_datacenter" "dc" {
  name = "${var.datacenter}"
}

data "vsphere_host" "hosts" {
  count         = "${length(var.hosts)}"
  name          = "${var.hosts[count.index]}"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

resource "vsphere_compute_cluster" "compute_cluster" {
  name            = "terraform-compute-cluster-test"
  datacenter_id   = "${data.vsphere_datacenter.dc.id}"
  host_system_ids = ["${data.vsphere_host.hosts.*.id}"]

  drs_enabled          = true
  drs_automation_level = "fullyAutomated"
}

resource "vsphere_dpm_host_override" "dpm_host_override" {
  compute_cluster_id   = "${vsphere_compute_cluster.compute_cluster.id}"
  host_system_id       = "${data.vsphere_host.hosts.0.id}"
  dpm_enabled          = true
  dpm_automation_level = "automated"
}

» Argument Reference

The following arguments are supported:

» Attribute Reference

The only attribute this resource exports is the id of the resource, which is a combination of the managed object reference ID of the cluster, and the managed object reference ID of the host. This is used to look up the override on subsequent plan and apply operations after the override has been created.

» Importing

An existing override can be imported into this resource by supplying both the path to the cluster, and the path to the host, to terraform import. If no override exists, an error will be given. An example is below:

terraform import vsphere_dpm_host_override.dpm_host_override \
  '{"compute_cluster_path": "/dc1/host/cluster1", \
  "host_path": "/dc1/host/esxi1"}'