nix-community/terraform-nixos

When nix_image_custom is updated, instances are not re-created correctly

mrkkrp opened this issue · 2 comments

I use nixos_image_custom to create a NixOS image from a given NixOS configuration and put it into a bucket. Then I use this image in google_compute_instance_template (via disk.source_image). The problem is that when I change the configuration I get the following error:

* google_compute_instance_template.buildkite_nixos: 1 error occurred:
* google_compute_instance_template.buildkite_nixos: reading body EOF

So I have to go delete the instance group first, then delete the template, and only after that I can run terraform plan and terraform apply. What should be happening instead is that terraform should be able to figure out that it should drop the old object in the bucket (containing the old image) and create a new object with the new image, then it should re-create template and instances accordingly.

I have seen that as well. I don't know exactly where the issue is coming from but it's annoying.

This can be worked around by first doing a terraform apply -target=module.name_of_the_module, then a terraform apply.

Maybe something seems to be wrong with the order.