vsphere/internal/virtualdevice/virtual_machine_cdrom_subresource.go
func VerifyVAppTransport(d *schema.ResourceDiff, c *govmomi.Client) error {
	log.Printf("[DEBUG] VAppDiffOperation: Verifying configuration meets requirements for vApp transport")
	// Check if there is a client CDROM device configured.
	cl := d.Get("cdrom")
	for _, c := range cl.([]interface{}) {
		if c.(map[string]interface{})["client_device"].(bool) == true {
			// There is a device configured that can support vApp ISO transport if needed
			log.Printf("[DEBUG] VAppDiffOperation: Client CDROM device exists which can support ISO transport")
			return nil
		}
	}
	// Iterate over each transport and see if ISO transport is supported.
	tm := d.Get("vapp_transport").([]interface{})
	for _, m := range tm {
		if m.(string) == vAppTransportIso && len(tm) == 1 {
			return fmt.Errorf("this virtual machine requires a client CDROM device to deliver vApp properties")
		}
	}
	log.Printf("[DEBUG] VAppDiffOperation: ISO transport is not supported on this virtual machine or multiple transport options exist")
	return nil
}
func VerifyVAppTransport(d *schema.ResourceDiff, c *govmomi.Client) error {
	log.Printf("[DEBUG] VAppDiffOperation: Verifying configuration meets requirements for vApp transport")
	// Check if there is a client CDROM device configured.
	cl := d.Get("cdrom")
	for _, c := range cl.([]interface{}) {
		if c.(map[string]interface{})["client_device"].(bool) == true {
			// There is a device configured that can support vApp ISO transport if needed
			log.Printf("[DEBUG] VAppDiffOperation: Client CDROM device exists which can support ISO transport")
			return nil
		}
	}
	// Iterate over each transport and see if ISO transport is supported.
	tm := d.Get("vapp_transport").([]interface{})
	for _, m := range tm {
		if m.(string) == vAppTransportIso && len(tm) == 1 {
			return fmt.Errorf("this virtual machine requires a client CDROM device to deliver vApp properties")
		}
	}
	log.Printf("[DEBUG] VAppDiffOperation: ISO transport is not supported on this virtual machine or multiple transport options exist")
	return nil
}
// VerifyVAppTransport validates that all the required components are included in
// the virtual machine configuration if vApp properties are set.