mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 18:42:58 +00:00
fix(vm): missing disks when importing VM to a TF state (#877)
* fix(vm): missing disks when importing VM to a TF state Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> * fix: add error handling Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --------- Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
72a988d72f
commit
a8bf497c7f
@ -4268,7 +4268,7 @@ func vmReadCustom(
|
||||
diskMap[di] = disk
|
||||
}
|
||||
|
||||
if len(currentDiskList) > 0 {
|
||||
if len(clone) == 0 || len(currentDiskList) > 0 {
|
||||
orderedDiskList := orderedListFromMap(diskMap)
|
||||
err := d.Set(mkResourceVirtualEnvironmentVMDisk, orderedDiskList)
|
||||
diags = append(diags, diag.FromErr(err)...)
|
||||
@ -5120,6 +5120,13 @@ func vmReadCustom(
|
||||
diags,
|
||||
vmReadNetworkValues(ctx, d, m, vmID, vmConfig)...)
|
||||
|
||||
// during import these core attributes might not be set, so set them explicitly here
|
||||
d.SetId(strconv.Itoa(vmID))
|
||||
e := d.Set(mkResourceVirtualEnvironmentVMVMID, vmID)
|
||||
diags = append(diags, diag.FromErr(e)...)
|
||||
e = d.Set(mkResourceVirtualEnvironmentVMNodeName, nodeName)
|
||||
diags = append(diags, diag.FromErr(e)...)
|
||||
|
||||
return diags
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user