vsphere/resource_vsphere_datastore_cluster_vm_anti_affinity_rule.go
func resourceVSphereDatastoreClusterVMAntiAffinityRuleValidateRuleVMCount(d *schema.ResourceData) error {
	if d.Get("virtual_machine_ids").(*schema.Set).Len() < 2 {
		return errors.New("length of virtual_machine_ids must be 2 or more")
	}
	return nil
}
func resourceVSphereDatastoreClusterVMAntiAffinityRuleValidateRuleVMCount(d *schema.ResourceData) error {
	if d.Get("virtual_machine_ids").(*schema.Set).Len() < 2 {
		return errors.New("length of virtual_machine_ids must be 2 or more")
	}
	return nil
}
func resourceVSphereDatastoreClusterVMAntiAffinityRuleValidateRuleVMCount ( d * schema . ResourceData ) error { if d . Get ( " " ) . ( * schema . Set ) . Len ( ) < 2 { return errors . New ( " " ) } return nil }
// resourceVSphereDatastoreClusterVMAntiAffinityRuleValidateRuleVMCount ensures
// that the VM count in the anti-affinity rule at any point in time before it's
// created or updated is a length of at least 2.
//
// This validation is necessary as a rule of only 1 VM here is a no-op and
// ultimately will result in a broken resource (the rule will not exist after
// creation, or example). Unfortunately, this needs to happen at apply time
// right now due to issues with TF core and how it processes lists when values
// are computed. Once these issues are fixed with TF core, the validation here
// should be removed and moved to schema.
resourceVSphereDatastoreClusterVMAntiAffinityRuleValidateRuleVMCount ensures that the VM count in the anti - affinity rule at any point in time before it s created or updated is a length of at least 2 . This validation is necessary as a rule of only 1 VM here is a no - op and ultimately will result in a broken resource ( the rule will not exist after creation or example ) . Unfortunately this needs to happen at apply time right now due to issues with TF core and how it processes lists when values are computed . Once these issues are fixed with TF core the validation here should be removed and moved to schema .