Closed cquike closed 1 month ago
So you mean something like image:latest
as we know it from Docker? I think that's a bit dangerous, because what would happen is that the instance would be destroyed and recreated with the new image version.
Yes, kind of that. The container would be recreated if the image version is different from the one used to create the container. I agree that's dangerous, but it might be useful in some scenarios to make sure that the containers are up to date. Of course that argument (say synced_image
for lack of a better name) would be false by default and only if it is explicitly set to true for a given container then that container is recreated.
I will close this issue because I don't see this a fit for the Terraform provider. If you think Incus should be able to do this then I ask you to create a feature request for Incus itself.
We manage a number of incus instances in a cluster with OpenTofu and this incus plugin. The images those instances use are custom ones that are managed by a "cronjob" that in turn uses packer. We would like to have an option to automatically restart the container in case the image it was created from has been updated. By updated I mean that the alias now points to a new image. It would be great if the
incus_instance
resource would add add an argument to ensure that the container is using the image that the current image alias is now pointing at. If the image hash of the container is not the same as the hash of theimage
argument, then the container is destroyed and recreated (and started i therunning
argument is true). The hash of the image used to create the container can be obtained withincus config get my-container volatile.base_image
.I guess that a reasonable expectation is that if the
image
is specified as a hash then nothing would happen. Also, ifimage
us an alias but it is no longer accessible from the provider remote then nothing happens either.Thanks!