vsphere/resource_vsphere_dpm_host_override.go
func resourceVSphereDPMHostOverrideFindEntry(
	cluster *object.ClusterComputeResource,
	host *object.HostSystem,
) (*types.ClusterDpmHostConfigInfo, error) {
	props, err := clustercomputeresource.Properties(cluster)
	if err != nil {
		return nil, fmt.Errorf("error fetching cluster properties: %s", err)
	}

	for _, info := range props.ConfigurationEx.(*types.ClusterConfigInfoEx).DpmHostConfig {
		if info.Key == host.Reference() {
			log.Printf("[DEBUG] Found DPM config info for host %q in cluster %q", host.Name(), cluster.Name())
			return &info, nil
		}
	}

	log.Printf("[DEBUG] No DPM config info found for host %q in cluster %q", host.Name(), cluster.Name())
	return nil, nil
}
func resourceVSphereDPMHostOverrideFindEntry(
	cluster *object.ClusterComputeResource,
	host *object.HostSystem,
) (*types.ClusterDpmHostConfigInfo, error) {
	props, err := clustercomputeresource.Properties(cluster)
	if err != nil {
		return nil, fmt.Errorf("error fetching cluster properties: %s", err)
	}

	for _, info := range props.ConfigurationEx.(*types.ClusterConfigInfoEx).DpmHostConfig {
		if info.Key == host.Reference() {
			log.Printf("[DEBUG] Found DPM config info for host %q in cluster %q", host.Name(), cluster.Name())
			return &info, nil
		}
	}

	log.Printf("[DEBUG] No DPM config info found for host %q in cluster %q", host.Name(), cluster.Name())
	return nil, nil
}
// resourceVSphereDPMHostOverrideFindEntry attempts to locate an existing DRS VM
// config in a cluster's configuration. It's used by the resource's read
// functionality and tests. nil is returned if the entry cannot be found.