Skip to content

Commit

Permalink
fix: Remove cloned ide2 before creating new one (#174) (#175)
Browse files Browse the repository at this point in the history
* fix: Remove cloned ide2 before creating new one (#174)

* add test case to `/examples`

Co-authored-by: Michał Gawryś <mgawrys@netbyte.pl>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 10, 2022
1 parent 60c6d58 commit 2766555
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions example/resource_virtual_environment_vm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ resource "proxmox_virtual_environment_vm" "example" {
"echo Welcome to $(hostname)!",
]
}

initialization {
dns {
server = "8.8.8.8"
}
}

}

output "resource_proxmox_virtual_environment_vm_example_id" {
Expand Down
7 changes: 6 additions & 1 deletion proxmoxtf/resource_virtual_environment_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,12 @@ func resourceVirtualEnvironmentVMCreateClone(ctx context.Context, d *schema.Reso
Media: &cdromCloudInitMedia,
},
}

ciUpdateBody := &proxmox.VirtualEnvironmentVMUpdateRequestBody{}
ciUpdateBody.Delete = append(ciUpdateBody.Delete, "ide2")
err = veClient.UpdateVM(ctx, nodeName, vmID, ciUpdateBody)
if err != nil {
return diag.FromErr(err)
}
initializationConfig, err := resourceVirtualEnvironmentVMGetCloudInitConfig(d)
if err != nil {
return diag.FromErr(err)
Expand Down

0 comments on commit 2766555

Please sign in to comment.