func resourceVSphereComputeClusterSaveDatacenter(
	d *schema.ResourceData,
	meta interface{},
	cluster *object.ClusterComputeResource,
) error {
	log.Printf("[DEBUG] %s: Saving datacenter", resourceVSphereComputeClusterIDString(d))
	client, err := resourceVSphereComputeClusterClient(meta)
	if err != nil {
		return err
	}

	p, err := folder.RootPathParticleHost.SplitDatacenter(cluster.InventoryPath)
	if err != nil {
		return fmt.Errorf("error parsing datacenter path from cluster: %s", err)
	}

	dc, err := getDatacenter(client, p)
	if err != nil {
		return fmt.Errorf("error fetching datacenter for cluster: %s", err)
	}

	return d.Set("datacenter_id", dc.Reference().Value)
}
func resourceVSphereComputeClusterSaveDatacenter(
	d *schema.ResourceData,
	meta interface{},
	cluster *object.ClusterComputeResource,
) error {
	log.Printf("[DEBUG] %s: Saving datacenter", resourceVSphereComputeClusterIDString(d))
	client, err := resourceVSphereComputeClusterClient(meta)
	if err != nil {
		return err
	}

	p, err := folder.RootPathParticleHost.SplitDatacenter(cluster.InventoryPath)
	if err != nil {
		return fmt.Errorf("error parsing datacenter path from cluster: %s", err)
	}

	dc, err := getDatacenter(client, p)
	if err != nil {
		return fmt.Errorf("error fetching datacenter for cluster: %s", err)
	}

	return d.Set("datacenter_id", dc.Reference().Value)
}
func resourceVSphereComputeClusterSaveDatacenter ( d * schema . ResourceData , meta interface { } , cluster * object . ClusterComputeResource , ) error { log . Printf ( " " , resourceVSphereComputeClusterIDString ( d ) ) client , err := resourceVSphereComputeClusterClient ( meta ) if err != nil { return err } p , err := folder . RootPathParticleHost . SplitDatacenter ( cluster . InventoryPath ) if err != nil { return fmt . Errorf ( " " , err ) } dc , err := getDatacenter ( client , p ) if err != nil { return fmt . Errorf ( " " , err ) } return d . Set ( " " , dc . Reference ( ) . Value ) }
// resourceVSphereComputeClusterSaveDatacenter saves the datacenter that the
// cluster is a member of for correctness on imports.
resourceVSphereComputeClusterSaveDatacenter saves the datacenter that the cluster is a member of for correctness on imports .