Skip to content
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

[3.0.1-rc6] order of cicustom elements forces replacement of entire vm #1224

Open
kagehisa opened this issue Jan 8, 2025 · 1 comment
Open
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/workaround it is or has a workaround resource/qemu Issue or PR related to Qemu resource type/bug

Comments

@kagehisa
Copy link

kagehisa commented Jan 8, 2025

Im using the cicustom attribute to provide my VMs with a cloud-init config that consists of meta-data, network-config and user-data. In code this looks something like this:

cicustom = "user=cloud-init:snippets/user_data_vm-${lower(each.value.name)}.yml,meta=cloud-init:snippets/meta_data_vm-${lower(each.value.name)}.yml,network=cloud-init:snippets/network_config_vm-${lower(each.value.name)}.yml"

This works and my VM's get successfully deployed. But when make a change to the code i.e. assign more ram or something else that would not justify a replacement, I get the following output from terrafrom apply/plan (example for vm name lff-r-vslnxc04):

~ cicustom  = "meta=cloud-init:snippets/meta_data_vm-lff-r-vslnxc04.yml,network=cloud-init:snippets/network_config_vm-lff-r-vslnxc04.yml,user=cloud-init:snippets/user_data_vm-lff-r-vslnxc04.yml" 
-> "user=cloud-init:snippets/user_data_vm-lff-r-vslnxc04.yml,meta=cloud-init:snippets/meta_data_vm-lff-r-vslnxc04.yml,network=cloud-init:snippets/network_config_vm-lff-r-vslnxc04.yml" # forces replacement

The order of the cloud-init files that is received from the current state is different to the order I have in code. I would assume this should be no problem, but this triggers a complete destroy and reapply of my infrastructure. When I change my code to reflect the cicustom order which the current state provides it works and all the desired vms get an update instead of a replacement.

So the issue is rather minor and could probably be addressed by a comment in the documentation regarding the ordering of the cicustom cloud-init config elements. I don't know if this behavior is intentional hence I decided to report it just in case.

@Tinyblargon
Copy link
Collaborator

@kagehisa Thank you for reporting this bug. The logic should be updated to not care about the order of those items.

@Tinyblargon Tinyblargon added type/bug issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/workaround it is or has a workaround resource/qemu Issue or PR related to Qemu resource labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented issue/workaround it is or has a workaround resource/qemu Issue or PR related to Qemu resource type/bug
Projects
None yet
Development

No branches or pull requests

2 participants