-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider allowing changes to VM resource's cloud_config
argument to force recreation
#205
Comments
That is already possible with the resource "xenorchestra_cloud_config" "user_data" { }
resource "xenorchestra_cloud_config" "network_data" { }
resource "xenorchestra_vm" "vm" {
lifecycle {
replace_triggered_by = [
xenorchestra_cloud_config.user_data,
xenorchestra_cloud_config.network_data,
]
}
} Terraform replaces the vm whenever That looks something like this # xenorchestra_vm.vm will be replaced due to changes in replace_triggered_by
-/+ resource "xenorchestra_vm" "vm" {
- blocked_operations = [] -> null
~ cloud_config = {REDACTED}
~ id = {REDACTED} -> (known after apply)
~ ipv4_addresses = [
- {REDACTED},
] -> (known after apply)
~ ipv6_addresses = [
- {REDACTED},
] -> (known after apply)
~ power_state = "Running" -> (known after apply)
tags = [
{REDACTED}
]
# (16 unchanged attributes hidden)
~ cdrom {
~ id = {REDACTED} -> {REDACTED}
}
~ disk {
- attached = true -> null
~ position = "0" -> (known after apply)
~ vbd_id = {REDACTED} -> (known after apply)
~ vdi_id = {REDACTED} -> (known after apply)
# (3 unchanged attributes hidden)
}
~ network {
- attached = true -> null
~ device = "0" -> (known after apply)
~ ipv4_addresses = [
- {REDACTED},
] -> (known after apply)
~ ipv6_addresses = [
- {REDACTED},
] -> (known after apply)
~ mac_address = {REDACTED} -> (known after apply)
# (1 unchanged attribute hidden)
}
} |
@4censord thanks for sharing that workaround. I still think it makes sense to unify this against what other similar providers are doing, but it's great that Terraform has this flexibility. |
I would also like to have the option for a change on the cloud-init data to force a power cycle of the vm. |
@4censord what I described in the issue description would be to cause the VM to be destroyed and recreated. Are you saying that if your case you want the VM to be rebooted? |
Yes, I would like to have the option to only reboot the vm resource "xenorchestra_vm" "vm" {
on_cloudinit_change = "reboot" # stop the vm, do the change, start the vm
on_cloudinit_change = "recreate" # destroy and recreate with the change
on_cloudinit_change = "ignore" # just change it (current behavior, defaul)
on_cloudinit_change = "fail" # Do not allow changes to the cloudinit config
} |
This was discussed in Discord.
It is surprising that the
cloud_config
argument is capable of being changed on axenorchestra_vm
when it likely will have no effect. Theaws_instance
resource in the AWS terraform provider allows a similar configuration through launch templates. This argument causes theaws_instance
resource to be recreated and so we should consider introducing this breaking change to fix this behavior and align it with how other providers treat cloud config / boot time configuration.The text was updated successfully, but these errors were encountered: