Change to cpu or memory adds fields to disk, causing recreation of the enter vm
Closed this issue · 2 comments
Consider the attached code to create a VM, changing values like cpu or memory causes pulumi to generate the following update plan:
$ pulumi up
Previewing update (dev)
Type Name Plan Info
pulumi:pulumi:Stack dks-dev
~ └─ proxmoxve:VM:VirtualMachine test update [diff: +cdrom~disks,memory]
Resources:
~ 1 to update
2 unchanged
Do you want to perform this update? details
pulumi:pulumi:Stack: (same)
[urn=urn:pulumi:dev::dks::pulumi:pulumi:Stack::dks-dev]
~ proxmoxve:VM/virtualMachine:VirtualMachine: (update)
[id=100]
[urn=urn:pulumi:dev::dks::proxmoxve:VM/virtualMachine:VirtualMachine::test]
[provider=urn:pulumi:dev::dks::pulumi:providers:proxmoxve::proxmoxve::beeb8915-a38f-4e0c-b557-5de5434d438f]
+ cdrom : {
+ enabled: false
+ fileId : ""
}
~ disks : [
~ [0]: {
+ speed: {
+ read : 0
+ readBurstable : 0
+ write : 0
+ writeBurstable: 0
}
}
]
~ memory: {
~ dedicated: 2048 => 1024
}
I actually changed the memory field, which is correctly represented in the update plan as a change from 2048 => 2014, however the additions to cdrom and the disks[0].speed shouldn't be there. While the addition of cdrom is only annoying when reviewing the update plan, the addition of the disk speed causes serious issues because changes to disks causes recreation of the VM, which means essientially every change causes a recreation, as you can see I tried manually adding the fields that get automatically added (the commented code) but that still causes a recreation. I was wondering if someone can reproduce this issue, if not I might have to check my template creation process.
new proxmox.vm.VirtualMachine('test', {
name: 'test',
nodeName: 'srv1',
agent: {enabled: true},
bios: 'seabios',
cpu: {cores: 4},
tags: ['test'],
clone: {
nodeName: 'srv1',
vmId: 9000,
full: false,
},
// cdrom: {enabled:false,fileId:''},
disks: [
{
interface: 'scsi0',
datastoreId: 'local-lvm',
size: 20,
// speed: {
// read:0,readBurstable:0,write:0,writeBurstable:0
// }
},
],
memory: {
dedicated: 1024,
},
networkDevices: [
{
bridge: 'vmbr0',
model: 'virtio',
},
],
onBoot: true,
operatingSystem: {
type: 'l26',
},
initialization: {
type: 'nocloud',
datastoreId: 'local-lvm',
dns: {
server: "10.0.0.1",
},
ipConfigs: [
{
ipv4: {
address: `10.0.22.22/16`,
gateway: '10.0.0.1',
},
},
],
userAccount: {
username: 'ubuntu',
keys: [sshkey],
},
},
}, {provider: provider})
yes, this issue should happen to others as well.
a work-around is ignoring changes to speed
properties like:
..., {
ignoreChanges: ['disks[0].speed']
}
this is related to the fact that proxmox returns these after creating the virtual machine; hence, the state contains these properties. the used terraform upstream provider though is not including these (default) values when rendering the terraform plan; hence, the pulumi provider detects this difference.
can you open an issue in the upstream provider, please?
since the work-around was sufficient for me and i never needed to specify these options, i didn't create one myself.
ignore changes worked for me, thanks for the reply