It has been a while since I worked with the Incus Tofu provider. The way I would normally solve this problem is by using a data source that would expose the image fingerprints from the source image.
I took a look at the provider and played around a bit. It looks like this data source is not implemented yet. Maybe submitting a feature request makes sense.
BTW: It is great to see some more Tofu users in the forums.
I hope it works the way I am thinking. The OCI part of the question might complicate things. I don’t remember how Incus deals with OCI and Incus image fingerprints. They are different things.
data "incus_image" "go-vod" {
remote = "docker"
name = "radialapps/go-vod"
}
resource "incus_instance" "go-vod" {
name = "go-vod"
image = data.incus_image.go-vod.fingerprint
ephemeral = false
}
results in:
│ Error: Failed to retrieve Incus ImageServer
│
│ with data.incus_image.go-vod,
│ on go-vod.tf line 1, in data "incus_image" "go-vod":
│ 1: data "incus_image" "go-vod" {
│
│ Remote "docker" (oci) is not an InstanceServer
Not sure if I’ve messed up the syntax or if this doesn’t currently support oci…
Yeah, I think it is OCI that is causing the issue. You could copy the image down then reference your local image. Then you could automate refreshing the image outside of Tofu.
At that point the data source should pick up the new fingerprint.