vsphere/virtual_machine_config_structure.go
func schemaVirtualMachineConfigSpec() map[string]*schema.Schema {
	s := map[string]*schema.Schema{
		// VirtualMachineBootOptions
		"boot_delay": {
			Type:        schema.TypeInt,
			Optional:    true,
			Description: "The number of milliseconds to wait before starting the boot sequence.",
		},
		"efi_secure_boot_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "When the boot type set in firmware is efi, this enables EFI secure boot.",
		},
		"boot_retry_delay": {
			Type:        schema.TypeInt,
			Optional:    true,
			Default:     10000,
			Description: "The number of milliseconds to wait before retrying the boot sequence. This only valid if boot_retry_enabled is true.",
		},
		"boot_retry_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "If set to true, a virtual machine that fails to boot will try again after the delay defined in boot_retry_delay.",
		},

		// VirtualMachineFlagInfo
		"enable_disk_uuid": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Expose the UUIDs of attached virtual disks to the virtual machine, allowing access to them in the guest.",
		},
		"hv_mode": {
			Type:         schema.TypeString,
			Optional:     true,
			Default:      string(types.VirtualMachineFlagInfoVirtualExecUsageHvAuto),
			Description:  "The (non-nested) hardware virtualization setting for this virtual machine. Can be one of hvAuto, hvOn, or hvOff.",
			ValidateFunc: validation.StringInSlice(virtualMachineVirtualExecUsageAllowedValues, false),
		},
		"ept_rvi_mode": {
			Type:         schema.TypeString,
			Optional:     true,
			Default:      string(types.VirtualMachineFlagInfoVirtualMmuUsageAutomatic),
			Description:  "The EPT/RVI (hardware memory virtualization) setting for this virtual machine. Can be one of automatic, on, or off.",
			ValidateFunc: validation.StringInSlice(virtualMachineVirtualMmuUsageAllowedValues, false),
		},
		"enable_logging": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enable logging on this virtual machine.",
		},

		// ToolsConfigInfo
		"sync_time_with_host": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enable guest clock synchronization with the host. Requires VMware tools to be installed.",
		},
		"run_tools_scripts_after_power_on": {
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     true,
			Description: "Enable the execution of post-power-on scripts when VMware tools is installed.",
		},
		"run_tools_scripts_after_resume": {
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     true,
			Description: "Enable the execution of post-resume scripts when VMware tools is installed.",
		},
		"run_tools_scripts_before_guest_reboot": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enable the execution of pre-reboot scripts when VMware tools is installed.",
		},
		"run_tools_scripts_before_guest_shutdown": {
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     true,
			Description: "Enable the execution of pre-shutdown scripts when VMware tools is installed.",
		},
		"run_tools_scripts_before_guest_standby": {
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     true,
			Description: "Enable the execution of pre-standby scripts when VMware tools is installed.",
		},

		// LatencySensitivity
		"latency_sensitivity": {
			Type:         schema.TypeString,
			Optional:     true,
			Default:      types.LatencySensitivitySensitivityLevelNormal,
			Description:  "Controls the scheduling delay of the virtual machine. Use a higher sensitivity for applications that require lower latency, such as VOIP, media player applications, or applications that require frequent access to mouse or keyboard devices. Can be one of low, normal, medium, or high.",
			ValidateFunc: validation.StringInSlice(virtualMachineLatencySensitivityAllowedValues, false),
		},

		// VirtualMachineConfigSpec
		"name": {
			Type:         schema.TypeString,
			Required:     true,
			Description:  "The name of this virtual machine.",
			ValidateFunc: validation.StringLenBetween(1, 80),
		},
		"num_cpus": {
			Type:        schema.TypeInt,
			Optional:    true,
			Default:     1,
			Description: "The number of virtual processors to assign to this virtual machine.",
		},
		"num_cores_per_socket": {
			Type:        schema.TypeInt,
			Optional:    true,
			Default:     1,
			Description: "The number of cores to distribute amongst the CPUs in this virtual machine. If specified, the value supplied to num_cpus must be evenly divisible by this value.",
		},
		"cpu_hot_add_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Allow CPUs to be added to this virtual machine while it is running.",
		},
		"cpu_hot_remove_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Allow CPUs to be added to this virtual machine while it is running.",
		},
		"nested_hv_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enable nested hardware virtualization on this virtual machine, facilitating nested virtualization in the guest.",
		},
		"cpu_performance_counters_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enable CPU performance counters on this virtual machine.",
		},
		"memory": {
			Type:        schema.TypeInt,
			Optional:    true,
			Default:     1024,
			Description: "The size of the virtual machine's memory, in MB.",
		},
		"memory_hot_add_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Allow memory to be added to this virtual machine while it is running.",
		},
		"swap_placement_policy": {
			Type:         schema.TypeString,
			Optional:     true,
			Default:      string(types.VirtualMachineConfigInfoSwapPlacementTypeInherit),
			Description:  "The swap file placement policy for this virtual machine. Can be one of inherit, hostLocal, or vmDirectory.",
			ValidateFunc: validation.StringInSlice(virtualMachineSwapPlacementAllowedValues, false),
		},
		"annotation": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "User-provided description of the virtual machine.",
		},
		"guest_id": {
			Type:        schema.TypeString,
			Optional:    true,
			Default:     "other-64",
			Description: "The guest ID for the operating system.",
		},
		"alternate_guest_name": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "The guest name for the operating system when guest_id is other or other-64.",
		},
		"firmware": {
			Type:         schema.TypeString,
			Optional:     true,
			Default:      string(types.GuestOsDescriptorFirmwareTypeBios),
			Description:  "The firmware interface to use on the virtual machine. Can be one of bios or EFI.",
			ValidateFunc: validation.StringInSlice(virtualMachineFirmwareAllowedValues, false),
		},
		"extra_config": {
			Type:        schema.TypeMap,
			Optional:    true,
			Description: "Extra configuration data for this virtual machine. Can be used to supply advanced parameters not normally in configuration, such as instance metadata, or configuration data for OVF images.",
		},
		"vapp": {
			Type:        schema.TypeList,
			Optional:    true,
			Description: "vApp configuration data for this virtual machine. Can be used to provide configuration data for OVF images.",
			MaxItems:    1,
			Elem:        &schema.Resource{Schema: vAppSubresourceSchema()},
		},
		"vapp_transport": {
			Type:        schema.TypeList,
			Computed:    true,
			Description: "vApp transport methods supported by virtual machine.",
			Elem:        &schema.Schema{Type: schema.TypeString},
		},
		"change_version": {
			Type:        schema.TypeString,
			Computed:    true,
			Description: "A unique identifier for a given version of the last configuration applied, such the timestamp of the last update to the configuration.",
		},
		"uuid": {
			Type:        schema.TypeString,
			Computed:    true,
			Description: "The UUID of the virtual machine. Also exposed as the ID of the resource.",
		},
	}
	structure.MergeSchema(s, schemaVirtualMachineResourceAllocation())
	return s
}
func schemaVirtualMachineConfigSpec() map[string]*schema.Schema {
	s := map[string]*schema.Schema{
		// VirtualMachineBootOptions
		"boot_delay": {
			Type:        schema.TypeInt,
			Optional:    true,
			Description: "The number of milliseconds to wait before starting the boot sequence.",
		},
		"efi_secure_boot_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "When the boot type set in firmware is efi, this enables EFI secure boot.",
		},
		"boot_retry_delay": {
			Type:        schema.TypeInt,
			Optional:    true,
			Default:     10000,
			Description: "The number of milliseconds to wait before retrying the boot sequence. This only valid if boot_retry_enabled is true.",
		},
		"boot_retry_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "If set to true, a virtual machine that fails to boot will try again after the delay defined in boot_retry_delay.",
		},

		// VirtualMachineFlagInfo
		"enable_disk_uuid": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Expose the UUIDs of attached virtual disks to the virtual machine, allowing access to them in the guest.",
		},
		"hv_mode": {
			Type:         schema.TypeString,
			Optional:     true,
			Default:      string(types.VirtualMachineFlagInfoVirtualExecUsageHvAuto),
			Description:  "The (non-nested) hardware virtualization setting for this virtual machine. Can be one of hvAuto, hvOn, or hvOff.",
			ValidateFunc: validation.StringInSlice(virtualMachineVirtualExecUsageAllowedValues, false),
		},
		"ept_rvi_mode": {
			Type:         schema.TypeString,
			Optional:     true,
			Default:      string(types.VirtualMachineFlagInfoVirtualMmuUsageAutomatic),
			Description:  "The EPT/RVI (hardware memory virtualization) setting for this virtual machine. Can be one of automatic, on, or off.",
			ValidateFunc: validation.StringInSlice(virtualMachineVirtualMmuUsageAllowedValues, false),
		},
		"enable_logging": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enable logging on this virtual machine.",
		},

		// ToolsConfigInfo
		"sync_time_with_host": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enable guest clock synchronization with the host. Requires VMware tools to be installed.",
		},
		"run_tools_scripts_after_power_on": {
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     true,
			Description: "Enable the execution of post-power-on scripts when VMware tools is installed.",
		},
		"run_tools_scripts_after_resume": {
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     true,
			Description: "Enable the execution of post-resume scripts when VMware tools is installed.",
		},
		"run_tools_scripts_before_guest_reboot": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enable the execution of pre-reboot scripts when VMware tools is installed.",
		},
		"run_tools_scripts_before_guest_shutdown": {
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     true,
			Description: "Enable the execution of pre-shutdown scripts when VMware tools is installed.",
		},
		"run_tools_scripts_before_guest_standby": {
			Type:        schema.TypeBool,
			Optional:    true,
			Default:     true,
			Description: "Enable the execution of pre-standby scripts when VMware tools is installed.",
		},

		// LatencySensitivity
		"latency_sensitivity": {
			Type:         schema.TypeString,
			Optional:     true,
			Default:      types.LatencySensitivitySensitivityLevelNormal,
			Description:  "Controls the scheduling delay of the virtual machine. Use a higher sensitivity for applications that require lower latency, such as VOIP, media player applications, or applications that require frequent access to mouse or keyboard devices. Can be one of low, normal, medium, or high.",
			ValidateFunc: validation.StringInSlice(virtualMachineLatencySensitivityAllowedValues, false),
		},

		// VirtualMachineConfigSpec
		"name": {
			Type:         schema.TypeString,
			Required:     true,
			Description:  "The name of this virtual machine.",
			ValidateFunc: validation.StringLenBetween(1, 80),
		},
		"num_cpus": {
			Type:        schema.TypeInt,
			Optional:    true,
			Default:     1,
			Description: "The number of virtual processors to assign to this virtual machine.",
		},
		"num_cores_per_socket": {
			Type:        schema.TypeInt,
			Optional:    true,
			Default:     1,
			Description: "The number of cores to distribute amongst the CPUs in this virtual machine. If specified, the value supplied to num_cpus must be evenly divisible by this value.",
		},
		"cpu_hot_add_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Allow CPUs to be added to this virtual machine while it is running.",
		},
		"cpu_hot_remove_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Allow CPUs to be added to this virtual machine while it is running.",
		},
		"nested_hv_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enable nested hardware virtualization on this virtual machine, facilitating nested virtualization in the guest.",
		},
		"cpu_performance_counters_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Enable CPU performance counters on this virtual machine.",
		},
		"memory": {
			Type:        schema.TypeInt,
			Optional:    true,
			Default:     1024,
			Description: "The size of the virtual machine's memory, in MB.",
		},
		"memory_hot_add_enabled": {
			Type:        schema.TypeBool,
			Optional:    true,
			Description: "Allow memory to be added to this virtual machine while it is running.",
		},
		"swap_placement_policy": {
			Type:         schema.TypeString,
			Optional:     true,
			Default:      string(types.VirtualMachineConfigInfoSwapPlacementTypeInherit),
			Description:  "The swap file placement policy for this virtual machine. Can be one of inherit, hostLocal, or vmDirectory.",
			ValidateFunc: validation.StringInSlice(virtualMachineSwapPlacementAllowedValues, false),
		},
		"annotation": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "User-provided description of the virtual machine.",
		},
		"guest_id": {
			Type:        schema.TypeString,
			Optional:    true,
			Default:     "other-64",
			Description: "The guest ID for the operating system.",
		},
		"alternate_guest_name": {
			Type:        schema.TypeString,
			Optional:    true,
			Description: "The guest name for the operating system when guest_id is other or other-64.",
		},
		"firmware": {
			Type:         schema.TypeString,
			Optional:     true,
			Default:      string(types.GuestOsDescriptorFirmwareTypeBios),
			Description:  "The firmware interface to use on the virtual machine. Can be one of bios or EFI.",
			ValidateFunc: validation.StringInSlice(virtualMachineFirmwareAllowedValues, false),
		},
		"extra_config": {
			Type:        schema.TypeMap,
			Optional:    true,
			Description: "Extra configuration data for this virtual machine. Can be used to supply advanced parameters not normally in configuration, such as instance metadata, or configuration data for OVF images.",
		},
		"vapp": {
			Type:        schema.TypeList,
			Optional:    true,
			Description: "vApp configuration data for this virtual machine. Can be used to provide configuration data for OVF images.",
			MaxItems:    1,
			Elem:        &schema.Resource{Schema: vAppSubresourceSchema()},
		},
		"vapp_transport": {
			Type:        schema.TypeList,
			Computed:    true,
			Description: "vApp transport methods supported by virtual machine.",
			Elem:        &schema.Schema{Type: schema.TypeString},
		},
		"change_version": {
			Type:        schema.TypeString,
			Computed:    true,
			Description: "A unique identifier for a given version of the last configuration applied, such the timestamp of the last update to the configuration.",
		},
		"uuid": {
			Type:        schema.TypeString,
			Computed:    true,
			Description: "The UUID of the virtual machine. Also exposed as the ID of the resource.",
		},
	}
	structure.MergeSchema(s, schemaVirtualMachineResourceAllocation())
	return s
}
// schemaVirtualMachineConfigSpec returns schema items for resources that
// need to work with a VirtualMachineConfigSpec.