terraform-nixos icon indicating copy to clipboard operation
terraform-nixos copied to clipboard

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

Open mrkkrp opened this issue 4 years ago • 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.

mrkkrp avatar Jan 24 '20 14:01 mrkkrp

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

zimbatm avatar Jan 24 '20 16:01 zimbatm

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.

flokli avatar Feb 18 '20 13:02 flokli