Skip to content

Commit

Permalink
bare_metal_server: Add persistent_pxe to create/update (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
neilmock committed Nov 13, 2023
1 parent 8bc2ef7 commit c220766
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
16 changes: 9 additions & 7 deletions vendor/github.com/vultr/govultr/v3/bare_metal_server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions vultr/resource_vultr_bare_metal_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ func resourceVultrBareMetalServer() *schema.Resource {
ForceNew: true,
Default: "",
},
"persistent_pxe": {
Type: schema.TypeBool,
Optional: true,
ForceNew: false,
},
"snapshot_id": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -208,6 +213,7 @@ func resourceVultrBareMetalServerCreate(ctx context.Context, d *schema.ResourceD
ActivationEmail: govultr.BoolToBoolPtr(d.Get("activation_email").(bool)),
Hostname: d.Get("hostname").(string),
ReservedIPv4: d.Get("reserved_ipv4").(string),
PersistentPXE: govultr.BoolToBoolPtr(d.Get("persistent").(bool)),
}

switch osOption {
Expand Down Expand Up @@ -346,9 +352,10 @@ func resourceVultrBareMetalServerUpdate(ctx context.Context, d *schema.ResourceD
client := meta.(*Client).govultrClient()

req := &govultr.BareMetalUpdate{
Label: d.Get("label").(string),
Tags: []string{},
EnableIPv6: govultr.BoolToBoolPtr(d.Get("enable_ipv6").(bool)),
Label: d.Get("label").(string),
Tags: []string{},
EnableIPv6: govultr.BoolToBoolPtr(d.Get("enable_ipv6").(bool)),
PersistentPXE: govultr.BoolToBoolPtr(d.Get("persistent_pxe").(bool)),
}

if d.HasChange("app_id") {
Expand Down
2 changes: 2 additions & 0 deletions vultr/resource_vultr_bare_metal_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func testAccVultrBareMetalServerConfigBasic(rInt int, rSSH, rName string) string
activation_email = false
ssh_key_ids = ["${vultr_ssh_key.foo.id}"]
script_id = "${vultr_startup_script.foo.id}"
persistent_pxe = true
user_data = "my user data"
label = "%s"
hostname = "%s"
Expand All @@ -155,6 +156,7 @@ func testAccVultrBareMetalServerConfigUpdate(rInt int, rSSH, rName string) strin
ssh_key_ids = ["${vultr_ssh_key.foo.id}"]
script_id = "${vultr_startup_script.foo.id}"
user_data = "my user data"
persistent_pxe = true
label = "%s-update"
hostname = "%s"
tags = [ "test tag", "another tag" ]
Expand Down

0 comments on commit c220766

Please sign in to comment.