Skip to content

Commit

Permalink
enhance(pxe): Add Network PXE boot option, doc, and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sygibson committed Feb 3, 2022
1 parent 4f30939 commit a645e0b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion proxmox/resource_vm_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ func resourceVmQemuCreate(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return err
}
} else if d.Get("pxe").(bool) == true {
} else if d.Get("pxe").(bool) {
var found bool
bs := d.Get("boot").(string)
regs := [...]string{"^n.*$", "^order=net.*$"}
Expand Down
21 changes: 21 additions & 0 deletions proxmox/resource_vm_qemu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,27 @@ func TestAccProxmoxVmQemu_CreateCloneWithTwoDisks(t *testing.T) {
})
}

// TestAccProxmoxVmQemu_PxeCreate tests a simple creation and destruction of the smallest, but
// but still viable, configuration for a PXE Network boot VM we can create.
func TestAccProxmoxVmQemu_PxeCreate(t *testing.T) {
resourceName := acctest.RandStringFromCharSet(10, acctest.CharSetAlpha)
resourcePath := fmt.Sprintf("proxmox_vm_qemu.%s", resourceName)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProxmoxProviderFactory(),
//CheckDestroy: testAccCheckExampleResourceDestroy,
Steps: []resource.TestStep{
{
Config: testAccExampleQemuPxe(resourceName, testAccProxmoxTargetNode),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourcePath, "name", resourceName),
),
},
},
})
}

// TestAccProxmoxVmQemu_StandardUpdateNoReboot tests a simple update of a vm_qemu resource,
// and the modified parameters can be applied without reboot.
func TestAccProxmoxVmQemu_UpdateNoReboot(t *testing.T) {
Expand Down

0 comments on commit a645e0b

Please sign in to comment.