add force_bios_setup configuration option
This commit is contained in:
parent
ae5156a70d
commit
921078ccc0
|
@ -52,6 +52,7 @@ type FlatConfig struct {
|
||||||
VGPUProfile *string `mapstructure:"vgpu_profile" cty:"vgpu_profile" hcl:"vgpu_profile"`
|
VGPUProfile *string `mapstructure:"vgpu_profile" cty:"vgpu_profile" hcl:"vgpu_profile"`
|
||||||
NestedHV *bool `mapstructure:"NestedHV" cty:"NestedHV" hcl:"NestedHV"`
|
NestedHV *bool `mapstructure:"NestedHV" cty:"NestedHV" hcl:"NestedHV"`
|
||||||
Firmware *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
|
Firmware *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
|
||||||
|
ForceBIOSSetup *bool `mapstructure:"force_bios_setup" cty:"force_bios_setup" hcl:"force_bios_setup"`
|
||||||
ConfigParams map[string]string `mapstructure:"configuration_parameters" cty:"configuration_parameters" hcl:"configuration_parameters"`
|
ConfigParams map[string]string `mapstructure:"configuration_parameters" cty:"configuration_parameters" hcl:"configuration_parameters"`
|
||||||
ToolsSyncTime *bool `mapstructure:"tools_sync_time" cty:"tools_sync_time" hcl:"tools_sync_time"`
|
ToolsSyncTime *bool `mapstructure:"tools_sync_time" cty:"tools_sync_time" hcl:"tools_sync_time"`
|
||||||
ToolsUpgradePolicy *bool `mapstructure:"tools_upgrade_policy" cty:"tools_upgrade_policy" hcl:"tools_upgrade_policy"`
|
ToolsUpgradePolicy *bool `mapstructure:"tools_upgrade_policy" cty:"tools_upgrade_policy" hcl:"tools_upgrade_policy"`
|
||||||
|
@ -170,6 +171,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
|
||||||
"vgpu_profile": &hcldec.AttrSpec{Name: "vgpu_profile", Type: cty.String, Required: false},
|
"vgpu_profile": &hcldec.AttrSpec{Name: "vgpu_profile", Type: cty.String, Required: false},
|
||||||
"NestedHV": &hcldec.AttrSpec{Name: "NestedHV", Type: cty.Bool, Required: false},
|
"NestedHV": &hcldec.AttrSpec{Name: "NestedHV", Type: cty.Bool, Required: false},
|
||||||
"firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false},
|
"firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false},
|
||||||
|
"force_bios_setup": &hcldec.AttrSpec{Name: "force_bios_setup", Type: cty.Bool, Required: false},
|
||||||
"configuration_parameters": &hcldec.AttrSpec{Name: "configuration_parameters", Type: cty.Map(cty.String), Required: false},
|
"configuration_parameters": &hcldec.AttrSpec{Name: "configuration_parameters", Type: cty.Map(cty.String), Required: false},
|
||||||
"tools_sync_time": &hcldec.AttrSpec{Name: "tools_sync_time", Type: cty.Bool, Required: false},
|
"tools_sync_time": &hcldec.AttrSpec{Name: "tools_sync_time", Type: cty.Bool, Required: false},
|
||||||
"tools_upgrade_policy": &hcldec.AttrSpec{Name: "tools_upgrade_policy", Type: cty.Bool, Required: false},
|
"tools_upgrade_policy": &hcldec.AttrSpec{Name: "tools_upgrade_policy", Type: cty.Bool, Required: false},
|
||||||
|
|
|
@ -39,8 +39,10 @@ type HardwareConfig struct {
|
||||||
VGPUProfile string `mapstructure:"vgpu_profile"`
|
VGPUProfile string `mapstructure:"vgpu_profile"`
|
||||||
// Enable nested hardware virtualization for VM. Defaults to `false`.
|
// Enable nested hardware virtualization for VM. Defaults to `false`.
|
||||||
NestedHV bool `mapstructure:"NestedHV"`
|
NestedHV bool `mapstructure:"NestedHV"`
|
||||||
// Set the Firmware for virtual machine. Supported values: `bios`, `efi`, `efi-secure` or empty string to keep as in template. Defaults to empty string.
|
// Set the Firmware for virtual machine. Supported values: `bios`, `efi` or `efi-secure`. Defaults to `bios`.
|
||||||
Firmware string `mapstructure:"firmware"`
|
Firmware string `mapstructure:"firmware"`
|
||||||
|
// During the boot, force entry into the BIOS setup screen. Defaults to `false`.
|
||||||
|
ForceBIOSSetup bool `mapstructure:"force_bios_setup"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *HardwareConfig) Prepare() []error {
|
func (c *HardwareConfig) Prepare() []error {
|
||||||
|
@ -82,6 +84,7 @@ func (s *StepConfigureHardware) Run(_ context.Context, state multistep.StateBag)
|
||||||
VideoRAM: s.Config.VideoRAM,
|
VideoRAM: s.Config.VideoRAM,
|
||||||
VGPUProfile: s.Config.VGPUProfile,
|
VGPUProfile: s.Config.VGPUProfile,
|
||||||
Firmware: s.Config.Firmware,
|
Firmware: s.Config.Firmware,
|
||||||
|
ForceBIOSSetup: s.Config.ForceBIOSSetup,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
|
|
|
@ -22,6 +22,7 @@ type FlatHardwareConfig struct {
|
||||||
VGPUProfile *string `mapstructure:"vgpu_profile" cty:"vgpu_profile" hcl:"vgpu_profile"`
|
VGPUProfile *string `mapstructure:"vgpu_profile" cty:"vgpu_profile" hcl:"vgpu_profile"`
|
||||||
NestedHV *bool `mapstructure:"NestedHV" cty:"NestedHV" hcl:"NestedHV"`
|
NestedHV *bool `mapstructure:"NestedHV" cty:"NestedHV" hcl:"NestedHV"`
|
||||||
Firmware *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
|
Firmware *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
|
||||||
|
ForceBIOSSetup *bool `mapstructure:"force_bios_setup" cty:"force_bios_setup" hcl:"force_bios_setup"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlatMapstructure returns a new FlatHardwareConfig.
|
// FlatMapstructure returns a new FlatHardwareConfig.
|
||||||
|
@ -36,19 +37,20 @@ func (*HardwareConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hclde
|
||||||
// The decoded values from this spec will then be applied to a FlatHardwareConfig.
|
// The decoded values from this spec will then be applied to a FlatHardwareConfig.
|
||||||
func (*FlatHardwareConfig) HCL2Spec() map[string]hcldec.Spec {
|
func (*FlatHardwareConfig) HCL2Spec() map[string]hcldec.Spec {
|
||||||
s := map[string]hcldec.Spec{
|
s := map[string]hcldec.Spec{
|
||||||
"CPUs": &hcldec.AttrSpec{Name: "CPUs", Type: cty.Number, Required: false},
|
"CPUs": &hcldec.AttrSpec{Name: "CPUs", Type: cty.Number, Required: false},
|
||||||
"cpu_cores": &hcldec.AttrSpec{Name: "cpu_cores", Type: cty.Number, Required: false},
|
"cpu_cores": &hcldec.AttrSpec{Name: "cpu_cores", Type: cty.Number, Required: false},
|
||||||
"CPU_reservation": &hcldec.AttrSpec{Name: "CPU_reservation", Type: cty.Number, Required: false},
|
"CPU_reservation": &hcldec.AttrSpec{Name: "CPU_reservation", Type: cty.Number, Required: false},
|
||||||
"CPU_limit": &hcldec.AttrSpec{Name: "CPU_limit", Type: cty.Number, Required: false},
|
"CPU_limit": &hcldec.AttrSpec{Name: "CPU_limit", Type: cty.Number, Required: false},
|
||||||
"CPU_hot_plug": &hcldec.AttrSpec{Name: "CPU_hot_plug", Type: cty.Bool, Required: false},
|
"CPU_hot_plug": &hcldec.AttrSpec{Name: "CPU_hot_plug", Type: cty.Bool, Required: false},
|
||||||
"RAM": &hcldec.AttrSpec{Name: "RAM", Type: cty.Number, Required: false},
|
"RAM": &hcldec.AttrSpec{Name: "RAM", Type: cty.Number, Required: false},
|
||||||
"RAM_reservation": &hcldec.AttrSpec{Name: "RAM_reservation", Type: cty.Number, Required: false},
|
"RAM_reservation": &hcldec.AttrSpec{Name: "RAM_reservation", Type: cty.Number, Required: false},
|
||||||
"RAM_reserve_all": &hcldec.AttrSpec{Name: "RAM_reserve_all", Type: cty.Bool, Required: false},
|
"RAM_reserve_all": &hcldec.AttrSpec{Name: "RAM_reserve_all", Type: cty.Bool, Required: false},
|
||||||
"RAM_hot_plug": &hcldec.AttrSpec{Name: "RAM_hot_plug", Type: cty.Bool, Required: false},
|
"RAM_hot_plug": &hcldec.AttrSpec{Name: "RAM_hot_plug", Type: cty.Bool, Required: false},
|
||||||
"video_ram": &hcldec.AttrSpec{Name: "video_ram", Type: cty.Number, Required: false},
|
"video_ram": &hcldec.AttrSpec{Name: "video_ram", Type: cty.Number, Required: false},
|
||||||
"vgpu_profile": &hcldec.AttrSpec{Name: "vgpu_profile", Type: cty.String, Required: false},
|
"vgpu_profile": &hcldec.AttrSpec{Name: "vgpu_profile", Type: cty.String, Required: false},
|
||||||
"NestedHV": &hcldec.AttrSpec{Name: "NestedHV", Type: cty.Bool, Required: false},
|
"NestedHV": &hcldec.AttrSpec{Name: "NestedHV", Type: cty.Bool, Required: false},
|
||||||
"firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false},
|
"firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false},
|
||||||
|
"force_bios_setup": &hcldec.AttrSpec{Name: "force_bios_setup", Type: cty.Bool, Required: false},
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ type HardwareConfig struct {
|
||||||
VideoRAM int64
|
VideoRAM int64
|
||||||
VGPUProfile string
|
VGPUProfile string
|
||||||
Firmware string
|
Firmware string
|
||||||
|
ForceBIOSSetup bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type NIC struct {
|
type NIC struct {
|
||||||
|
@ -75,8 +76,7 @@ type CreateConfig struct {
|
||||||
GuestOS string // example: otherGuest
|
GuestOS string // example: otherGuest
|
||||||
NICs []NIC
|
NICs []NIC
|
||||||
USBController bool
|
USBController bool
|
||||||
Version uint // example: 10
|
Version uint // example: 10
|
||||||
Firmware string // efi-secure, efi or bios
|
|
||||||
Storage []Disk
|
Storage []Disk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,14 +139,6 @@ func (d *Driver) CreateVM(config *CreateConfig) (*VirtualMachine, error) {
|
||||||
if config.Version != 0 {
|
if config.Version != 0 {
|
||||||
createSpec.Version = fmt.Sprintf("%s%d", "vmx-", config.Version)
|
createSpec.Version = fmt.Sprintf("%s%d", "vmx-", config.Version)
|
||||||
}
|
}
|
||||||
if config.Firmware == "efi-secure" {
|
|
||||||
createSpec.Firmware = "efi"
|
|
||||||
createSpec.BootOptions = &types.VirtualMachineBootOptions{
|
|
||||||
EfiSecureBootEnabled: types.NewBool(true),
|
|
||||||
}
|
|
||||||
} else if config.Firmware != "" {
|
|
||||||
createSpec.Firmware = config.Firmware
|
|
||||||
}
|
|
||||||
|
|
||||||
folder, err := d.FindFolder(config.Folder)
|
folder, err := d.FindFolder(config.Folder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -499,13 +491,18 @@ func (vm *VirtualMachine) Configure(config *HardwareConfig) error {
|
||||||
confSpec.DeviceChange = append(confSpec.DeviceChange, spec)
|
confSpec.DeviceChange = append(confSpec.DeviceChange, spec)
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.Firmware == "efi-secure" || config.Firmware == "efi" {
|
efiSecureBootEnabled := false
|
||||||
confSpec.Firmware = "efi"
|
firmware := config.Firmware
|
||||||
confSpec.BootOptions = &types.VirtualMachineBootOptions{
|
|
||||||
EfiSecureBootEnabled: types.NewBool(config.Firmware == "efi-secure"),
|
if firmware == "efi-secure" {
|
||||||
}
|
firmware = "efi"
|
||||||
} else if config.Firmware != "" {
|
efiSecureBootEnabled = true
|
||||||
confSpec.Firmware = config.Firmware
|
}
|
||||||
|
|
||||||
|
confSpec.Firmware = firmware
|
||||||
|
confSpec.BootOptions = &types.VirtualMachineBootOptions{
|
||||||
|
EnterBIOSSetup: types.NewBool(config.ForceBIOSSetup),
|
||||||
|
EfiSecureBootEnabled: types.NewBool(efiSecureBootEnabled),
|
||||||
}
|
}
|
||||||
|
|
||||||
task, err := vm.vm.Reconfigure(vm.driver.ctx, confSpec)
|
task, err := vm.vm.Reconfigure(vm.driver.ctx, confSpec)
|
||||||
|
|
|
@ -60,11 +60,6 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// default Firmware to "" since it is already configured by the CreateConfig.Firmware
|
|
||||||
if b.config.CreateConfig.Firmware != "" {
|
|
||||||
b.config.HardwareConfig.Firmware = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
steps = append(steps,
|
steps = append(steps,
|
||||||
&StepCreateVM{
|
&StepCreateVM{
|
||||||
Config: &b.config.CreateConfig,
|
Config: &b.config.CreateConfig,
|
||||||
|
|
|
@ -28,7 +28,6 @@ type FlatConfig struct {
|
||||||
Datacenter *string `mapstructure:"datacenter" cty:"datacenter" hcl:"datacenter"`
|
Datacenter *string `mapstructure:"datacenter" cty:"datacenter" hcl:"datacenter"`
|
||||||
Version *uint `mapstructure:"vm_version" cty:"vm_version" hcl:"vm_version"`
|
Version *uint `mapstructure:"vm_version" cty:"vm_version" hcl:"vm_version"`
|
||||||
GuestOSType *string `mapstructure:"guest_os_type" cty:"guest_os_type" hcl:"guest_os_type"`
|
GuestOSType *string `mapstructure:"guest_os_type" cty:"guest_os_type" hcl:"guest_os_type"`
|
||||||
Firmware *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
|
|
||||||
DiskControllerType []string `mapstructure:"disk_controller_type" cty:"disk_controller_type" hcl:"disk_controller_type"`
|
DiskControllerType []string `mapstructure:"disk_controller_type" cty:"disk_controller_type" hcl:"disk_controller_type"`
|
||||||
Storage []FlatDiskConfig `mapstructure:"storage" cty:"storage" hcl:"storage"`
|
Storage []FlatDiskConfig `mapstructure:"storage" cty:"storage" hcl:"storage"`
|
||||||
NICs []FlatNIC `mapstructure:"network_adapters" cty:"network_adapters" hcl:"network_adapters"`
|
NICs []FlatNIC `mapstructure:"network_adapters" cty:"network_adapters" hcl:"network_adapters"`
|
||||||
|
@ -53,6 +52,8 @@ type FlatConfig struct {
|
||||||
VideoRAM *int64 `mapstructure:"video_ram" cty:"video_ram" hcl:"video_ram"`
|
VideoRAM *int64 `mapstructure:"video_ram" cty:"video_ram" hcl:"video_ram"`
|
||||||
VGPUProfile *string `mapstructure:"vgpu_profile" cty:"vgpu_profile" hcl:"vgpu_profile"`
|
VGPUProfile *string `mapstructure:"vgpu_profile" cty:"vgpu_profile" hcl:"vgpu_profile"`
|
||||||
NestedHV *bool `mapstructure:"NestedHV" cty:"NestedHV" hcl:"NestedHV"`
|
NestedHV *bool `mapstructure:"NestedHV" cty:"NestedHV" hcl:"NestedHV"`
|
||||||
|
Firmware *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
|
||||||
|
ForceBIOSSetup *bool `mapstructure:"force_bios_setup" cty:"force_bios_setup" hcl:"force_bios_setup"`
|
||||||
ConfigParams map[string]string `mapstructure:"configuration_parameters" cty:"configuration_parameters" hcl:"configuration_parameters"`
|
ConfigParams map[string]string `mapstructure:"configuration_parameters" cty:"configuration_parameters" hcl:"configuration_parameters"`
|
||||||
ToolsSyncTime *bool `mapstructure:"tools_sync_time" cty:"tools_sync_time" hcl:"tools_sync_time"`
|
ToolsSyncTime *bool `mapstructure:"tools_sync_time" cty:"tools_sync_time" hcl:"tools_sync_time"`
|
||||||
ToolsUpgradePolicy *bool `mapstructure:"tools_upgrade_policy" cty:"tools_upgrade_policy" hcl:"tools_upgrade_policy"`
|
ToolsUpgradePolicy *bool `mapstructure:"tools_upgrade_policy" cty:"tools_upgrade_policy" hcl:"tools_upgrade_policy"`
|
||||||
|
@ -159,7 +160,6 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
|
||||||
"datacenter": &hcldec.AttrSpec{Name: "datacenter", Type: cty.String, Required: false},
|
"datacenter": &hcldec.AttrSpec{Name: "datacenter", Type: cty.String, Required: false},
|
||||||
"vm_version": &hcldec.AttrSpec{Name: "vm_version", Type: cty.Number, Required: false},
|
"vm_version": &hcldec.AttrSpec{Name: "vm_version", Type: cty.Number, Required: false},
|
||||||
"guest_os_type": &hcldec.AttrSpec{Name: "guest_os_type", Type: cty.String, Required: false},
|
"guest_os_type": &hcldec.AttrSpec{Name: "guest_os_type", Type: cty.String, Required: false},
|
||||||
"firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false},
|
|
||||||
"disk_controller_type": &hcldec.AttrSpec{Name: "disk_controller_type", Type: cty.List(cty.String), Required: false},
|
"disk_controller_type": &hcldec.AttrSpec{Name: "disk_controller_type", Type: cty.List(cty.String), Required: false},
|
||||||
"storage": &hcldec.BlockListSpec{TypeName: "storage", Nested: hcldec.ObjectSpec((*FlatDiskConfig)(nil).HCL2Spec())},
|
"storage": &hcldec.BlockListSpec{TypeName: "storage", Nested: hcldec.ObjectSpec((*FlatDiskConfig)(nil).HCL2Spec())},
|
||||||
"network_adapters": &hcldec.BlockListSpec{TypeName: "network_adapters", Nested: hcldec.ObjectSpec((*FlatNIC)(nil).HCL2Spec())},
|
"network_adapters": &hcldec.BlockListSpec{TypeName: "network_adapters", Nested: hcldec.ObjectSpec((*FlatNIC)(nil).HCL2Spec())},
|
||||||
|
@ -184,6 +184,8 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
|
||||||
"video_ram": &hcldec.AttrSpec{Name: "video_ram", Type: cty.Number, Required: false},
|
"video_ram": &hcldec.AttrSpec{Name: "video_ram", Type: cty.Number, Required: false},
|
||||||
"vgpu_profile": &hcldec.AttrSpec{Name: "vgpu_profile", Type: cty.String, Required: false},
|
"vgpu_profile": &hcldec.AttrSpec{Name: "vgpu_profile", Type: cty.String, Required: false},
|
||||||
"NestedHV": &hcldec.AttrSpec{Name: "NestedHV", Type: cty.Bool, Required: false},
|
"NestedHV": &hcldec.AttrSpec{Name: "NestedHV", Type: cty.Bool, Required: false},
|
||||||
|
"firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false},
|
||||||
|
"force_bios_setup": &hcldec.AttrSpec{Name: "force_bios_setup", Type: cty.Bool, Required: false},
|
||||||
"configuration_parameters": &hcldec.AttrSpec{Name: "configuration_parameters", Type: cty.Map(cty.String), Required: false},
|
"configuration_parameters": &hcldec.AttrSpec{Name: "configuration_parameters", Type: cty.Map(cty.String), Required: false},
|
||||||
"tools_sync_time": &hcldec.AttrSpec{Name: "tools_sync_time", Type: cty.Bool, Required: false},
|
"tools_sync_time": &hcldec.AttrSpec{Name: "tools_sync_time", Type: cty.Bool, Required: false},
|
||||||
"tools_upgrade_policy": &hcldec.AttrSpec{Name: "tools_upgrade_policy", Type: cty.Bool, Required: false},
|
"tools_upgrade_policy": &hcldec.AttrSpec{Name: "tools_upgrade_policy", Type: cty.Bool, Required: false},
|
||||||
|
|
|
@ -101,8 +101,6 @@ type CreateConfig struct {
|
||||||
// here](https://code.vmware.com/apis/358/vsphere/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html)
|
// here](https://code.vmware.com/apis/358/vsphere/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html)
|
||||||
// for a full list of possible values.
|
// for a full list of possible values.
|
||||||
GuestOSType string `mapstructure:"guest_os_type"`
|
GuestOSType string `mapstructure:"guest_os_type"`
|
||||||
// Set the Firmware at machine creation. Supported values: `bios`, `efi` or `efi-secure`. Defaults to `bios`.
|
|
||||||
Firmware string `mapstructure:"firmware"`
|
|
||||||
// Set VM disk controller type. Example `lsilogic`, pvscsi`, or `scsi`. Use a list to define additional controllers. Defaults to `lsilogic`
|
// Set VM disk controller type. Example `lsilogic`, pvscsi`, or `scsi`. Use a list to define additional controllers. Defaults to `lsilogic`
|
||||||
DiskControllerType []string `mapstructure:"disk_controller_type"`
|
DiskControllerType []string `mapstructure:"disk_controller_type"`
|
||||||
// A collection of one or more disks to be provisioned along with the VM.
|
// A collection of one or more disks to be provisioned along with the VM.
|
||||||
|
@ -138,10 +136,6 @@ func (c *CreateConfig) Prepare() []error {
|
||||||
c.GuestOSType = "otherGuest"
|
c.GuestOSType = "otherGuest"
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Firmware != "" && c.Firmware != "bios" && c.Firmware != "efi" && c.Firmware != "efi-secure" {
|
|
||||||
errs = append(errs, fmt.Errorf("'firmware' must be 'bios', 'efi' or 'efi-secure'"))
|
|
||||||
}
|
|
||||||
|
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +194,6 @@ func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multiste
|
||||||
NICs: networkCards,
|
NICs: networkCards,
|
||||||
USBController: s.Config.USBController,
|
USBController: s.Config.USBController,
|
||||||
Version: s.Config.Version,
|
Version: s.Config.Version,
|
||||||
Firmware: s.Config.Firmware,
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
state.Put("error", fmt.Errorf("error creating vm: %v", err))
|
state.Put("error", fmt.Errorf("error creating vm: %v", err))
|
||||||
|
|
|
@ -11,7 +11,6 @@ import (
|
||||||
type FlatCreateConfig struct {
|
type FlatCreateConfig struct {
|
||||||
Version *uint `mapstructure:"vm_version" cty:"vm_version" hcl:"vm_version"`
|
Version *uint `mapstructure:"vm_version" cty:"vm_version" hcl:"vm_version"`
|
||||||
GuestOSType *string `mapstructure:"guest_os_type" cty:"guest_os_type" hcl:"guest_os_type"`
|
GuestOSType *string `mapstructure:"guest_os_type" cty:"guest_os_type" hcl:"guest_os_type"`
|
||||||
Firmware *string `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
|
|
||||||
DiskControllerType []string `mapstructure:"disk_controller_type" cty:"disk_controller_type" hcl:"disk_controller_type"`
|
DiskControllerType []string `mapstructure:"disk_controller_type" cty:"disk_controller_type" hcl:"disk_controller_type"`
|
||||||
Storage []FlatDiskConfig `mapstructure:"storage" cty:"storage" hcl:"storage"`
|
Storage []FlatDiskConfig `mapstructure:"storage" cty:"storage" hcl:"storage"`
|
||||||
NICs []FlatNIC `mapstructure:"network_adapters" cty:"network_adapters" hcl:"network_adapters"`
|
NICs []FlatNIC `mapstructure:"network_adapters" cty:"network_adapters" hcl:"network_adapters"`
|
||||||
|
@ -33,7 +32,6 @@ func (*FlatCreateConfig) HCL2Spec() map[string]hcldec.Spec {
|
||||||
s := map[string]hcldec.Spec{
|
s := map[string]hcldec.Spec{
|
||||||
"vm_version": &hcldec.AttrSpec{Name: "vm_version", Type: cty.Number, Required: false},
|
"vm_version": &hcldec.AttrSpec{Name: "vm_version", Type: cty.Number, Required: false},
|
||||||
"guest_os_type": &hcldec.AttrSpec{Name: "guest_os_type", Type: cty.String, Required: false},
|
"guest_os_type": &hcldec.AttrSpec{Name: "guest_os_type", Type: cty.String, Required: false},
|
||||||
"firmware": &hcldec.AttrSpec{Name: "firmware", Type: cty.String, Required: false},
|
|
||||||
"disk_controller_type": &hcldec.AttrSpec{Name: "disk_controller_type", Type: cty.List(cty.String), Required: false},
|
"disk_controller_type": &hcldec.AttrSpec{Name: "disk_controller_type", Type: cty.List(cty.String), Required: false},
|
||||||
"storage": &hcldec.BlockListSpec{TypeName: "storage", Nested: hcldec.ObjectSpec((*FlatDiskConfig)(nil).HCL2Spec())},
|
"storage": &hcldec.BlockListSpec{TypeName: "storage", Nested: hcldec.ObjectSpec((*FlatDiskConfig)(nil).HCL2Spec())},
|
||||||
"network_adapters": &hcldec.BlockListSpec{TypeName: "network_adapters", Nested: hcldec.ObjectSpec((*FlatNIC)(nil).HCL2Spec())},
|
"network_adapters": &hcldec.BlockListSpec{TypeName: "network_adapters", Nested: hcldec.ObjectSpec((*FlatNIC)(nil).HCL2Spec())},
|
||||||
|
|
|
@ -26,5 +26,7 @@
|
||||||
|
|
||||||
- `NestedHV` (bool) - Enable nested hardware virtualization for VM. Defaults to `false`.
|
- `NestedHV` (bool) - Enable nested hardware virtualization for VM. Defaults to `false`.
|
||||||
|
|
||||||
- `firmware` (string) - Set the Firmware for virtual machine. Supported values: `bios`, `efi`, `efi-secure` or empty string to keep as in template. Defaults to empty string.
|
- `firmware` (string) - Set the Firmware for virtual machine. Supported values: `bios`, `efi` or `efi-secure`. Defaults to `bios`.
|
||||||
|
|
||||||
|
- `force_bios_setup` (bool) - During the boot, force entry into the BIOS setup screen. Defaults to `false`.
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
here](https://code.vmware.com/apis/358/vsphere/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html)
|
here](https://code.vmware.com/apis/358/vsphere/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html)
|
||||||
for a full list of possible values.
|
for a full list of possible values.
|
||||||
|
|
||||||
- `firmware` (string) - Set the Firmware at machine creation. Supported values: `bios`, `efi` or `efi-secure`. Defaults to `bios`.
|
|
||||||
|
|
||||||
- `disk_controller_type` ([]string) - Set VM disk controller type. Example `lsilogic`, pvscsi`, or `scsi`. Use a list to define additional controllers. Defaults to `lsilogic`
|
- `disk_controller_type` ([]string) - Set VM disk controller type. Example `lsilogic`, pvscsi`, or `scsi`. Use a list to define additional controllers. Defaults to `lsilogic`
|
||||||
|
|
||||||
- `storage` ([]DiskConfig) - A collection of one or more disks to be provisioned along with the VM.
|
- `storage` ([]DiskConfig) - A collection of one or more disks to be provisioned along with the VM.
|
||||||
|
|
Loading…
Reference in New Issue