vsphere/virtual_machine_config_structure.go
func expandVirtualMachineConfigSpec(d *schema.ResourceData, client *govmomi.Client) (types.VirtualMachineConfigSpec, error) {
	log.Printf("[DEBUG] %s: Building config spec", resourceVSphereVirtualMachineIDString(d))
	vappConfig, err := expandVAppConfig(d, client)
	if err != nil {
		return types.VirtualMachineConfigSpec{}, err
	}

	obj := types.VirtualMachineConfigSpec{
		Name:                         d.Get("name").(string),
		GuestId:                      getWithRestart(d, "guest_id").(string),
		AlternateGuestName:           getWithRestart(d, "alternate_guest_name").(string),
		Annotation:                   d.Get("annotation").(string),
		Tools:                        expandToolsConfigInfo(d),
		Flags:                        expandVirtualMachineFlagInfo(d),
		NumCPUs:                      expandCPUCountConfig(d),
		NumCoresPerSocket:            int32(getWithRestart(d, "num_cores_per_socket").(int)),
		MemoryMB:                     expandMemorySizeConfig(d),
		MemoryHotAddEnabled:          getBoolWithRestart(d, "memory_hot_add_enabled"),
		CpuHotAddEnabled:             getBoolWithRestart(d, "cpu_hot_add_enabled"),
		CpuHotRemoveEnabled:          getBoolWithRestart(d, "cpu_hot_remove_enabled"),
		CpuAllocation:                expandVirtualMachineResourceAllocation(d, "cpu"),
		MemoryAllocation:             expandVirtualMachineResourceAllocation(d, "memory"),
		MemoryReservationLockedToMax: getMemoryReservationLockedToMax(d),
		ExtraConfig:                  expandExtraConfig(d),
		SwapPlacement:                getWithRestart(d, "swap_placement_policy").(string),
		BootOptions:                  expandVirtualMachineBootOptions(d, client),
		VAppConfig:                   vappConfig,
		Firmware:                     getWithRestart(d, "firmware").(string),
		NestedHVEnabled:              getBoolWithRestart(d, "nested_hv_enabled"),
		VPMCEnabled:                  getBoolWithRestart(d, "cpu_performance_counters_enabled"),
		LatencySensitivity:           expandLatencySensitivity(d),
	}

	return obj, nil
}
func expandVirtualMachineConfigSpec(d *schema.ResourceData, client *govmomi.Client) (types.VirtualMachineConfigSpec, error) {
	log.Printf("[DEBUG] %s: Building config spec", resourceVSphereVirtualMachineIDString(d))
	vappConfig, err := expandVAppConfig(d, client)
	if err != nil {
		return types.VirtualMachineConfigSpec{}, err
	}

	obj := types.VirtualMachineConfigSpec{
		Name:                         d.Get("name").(string),
		GuestId:                      getWithRestart(d, "guest_id").(string),
		AlternateGuestName:           getWithRestart(d, "alternate_guest_name").(string),
		Annotation:                   d.Get("annotation").(string),
		Tools:                        expandToolsConfigInfo(d),
		Flags:                        expandVirtualMachineFlagInfo(d),
		NumCPUs:                      expandCPUCountConfig(d),
		NumCoresPerSocket:            int32(getWithRestart(d, "num_cores_per_socket").(int)),
		MemoryMB:                     expandMemorySizeConfig(d),
		MemoryHotAddEnabled:          getBoolWithRestart(d, "memory_hot_add_enabled"),
		CpuHotAddEnabled:             getBoolWithRestart(d, "cpu_hot_add_enabled"),
		CpuHotRemoveEnabled:          getBoolWithRestart(d, "cpu_hot_remove_enabled"),
		CpuAllocation:                expandVirtualMachineResourceAllocation(d, "cpu"),
		MemoryAllocation:             expandVirtualMachineResourceAllocation(d, "memory"),
		MemoryReservationLockedToMax: getMemoryReservationLockedToMax(d),
		ExtraConfig:                  expandExtraConfig(d),
		SwapPlacement:                getWithRestart(d, "swap_placement_policy").(string),
		BootOptions:                  expandVirtualMachineBootOptions(d, client),
		VAppConfig:                   vappConfig,
		Firmware:                     getWithRestart(d, "firmware").(string),
		NestedHVEnabled:              getBoolWithRestart(d, "nested_hv_enabled"),
		VPMCEnabled:                  getBoolWithRestart(d, "cpu_performance_counters_enabled"),
		LatencySensitivity:           expandLatencySensitivity(d),
	}

	return obj, nil
}
func expandVirtualMachineConfigSpec ( d * schema . ResourceData , client * govmomi . Client ) ( types . VirtualMachineConfigSpec , error ) { log . Printf ( " " , resourceVSphereVirtualMachineIDString ( d ) ) vappConfig , err := expandVAppConfig ( d , client ) if err != nil { return types . VirtualMachineConfigSpec { } , err } obj := types . VirtualMachineConfigSpec { Name : d . Get ( " " ) . ( string ) , GuestId : getWithRestart ( d , " " ) . ( string ) , AlternateGuestName : getWithRestart ( d , " " ) . ( string ) , Annotation : d . Get ( " " ) . ( string ) , Tools : expandToolsConfigInfo ( d ) , Flags : expandVirtualMachineFlagInfo ( d ) , NumCPUs : expandCPUCountConfig ( d ) , NumCoresPerSocket : int32 ( getWithRestart ( d , " " ) . ( int ) ) , MemoryMB : expandMemorySizeConfig ( d ) , MemoryHotAddEnabled : getBoolWithRestart ( d , " " ) , CpuHotAddEnabled : getBoolWithRestart ( d , " " ) , CpuHotRemoveEnabled : getBoolWithRestart ( d , " " ) , CpuAllocation : expandVirtualMachineResourceAllocation ( d , " " ) , MemoryAllocation : expandVirtualMachineResourceAllocation ( d , " " ) , MemoryReservationLockedToMax : getMemoryReservationLockedToMax ( d ) , ExtraConfig : expandExtraConfig ( d ) , SwapPlacement : getWithRestart ( d , " " ) . ( string ) , BootOptions : expandVirtualMachineBootOptions ( d , client ) , VAppConfig : vappConfig , Firmware : getWithRestart ( d , " " ) . ( string ) , NestedHVEnabled : getBoolWithRestart ( d , " " ) , VPMCEnabled : getBoolWithRestart ( d , " " ) , LatencySensitivity : expandLatencySensitivity ( d ) , } return obj , nil }
// expandVirtualMachineConfigSpec reads certain ResourceData keys and
// returns a VirtualMachineConfigSpec.
expandVirtualMachineConfigSpec reads certain ResourceData keys and returns a VirtualMachineConfigSpec .