You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation is lacking, but it is possible to change the state of an instance from "Running" to "Ready" from inside the instance with curl --unix-socket /dev/incus/sock -X PATCH -d '{"state": "Ready"}' incus/1.0. 1
The incus_instance resource currently have a wait_for_network that checks if a instance have an IPv4-address on any interface. It would be very useful to have something similar to wait for the state/status to be "Ready".
The startup script could set the state to ready when the services on the instance are running. Then terraform could wait for that and continue its work afterwards. In my case I want to contact kubernetes on the newly created instance from the kubectl terraform provider in the same terraform apply. It is currently not possible because terraform would see the incus_instance as done before the kubernetes cluster on it is running and fail to apply the resources with kubectl.
Bug
When setting the state to "Ready" with the above curl call, a subsequent terraform apply would show the following plan:
# incus_instance.k8s-node[0] will be updated in-place
~ resource "incus_instance" "k8s-node" {
~ ipv4_address = "10.60.0.100" -> (known after apply)
+ ipv6_address = (known after apply)
~ mac_address = "00:16:3e:8f:9c:43" -> (known after apply)
name = "k8s-node-0"
~ running = false -> true
~ status = "Ready" -> (known after apply)
+ target = (known after apply)
# (7 unchanged attributes hidden)
}
And after confirming, would fail with:
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to incus_instance.k8s-node[0], provider
│ "provider[\"registry.opentofu.org/lxc/incus\"]" produced an unexpected new value: .running: was
│ cty.True, but now cty.False.
From the CLI the cloud-init status can be checked by incus exec my-instance -- cloud-init status --wait. With the proposed exec from #86, I would expect terraform to wait for the exec block to finish before moving on. It would then be trivial to just do cloud-init status --wait in an exec block. Alternatively, I could just move all my functionality currently implemented with cloud-init to an exec.
Footnotes
I found this out from these fragmented documentation bits: 1, 2, 3, 4↩
The text was updated successfully, but these errors were encountered:
Feature request
The documentation is lacking, but it is possible to change the state of an instance from "Running" to "Ready" from inside the instance with
curl --unix-socket /dev/incus/sock -X PATCH -d '{"state": "Ready"}' incus/1.0
. 1The
incus_instance
resource currently have await_for_network
that checks if a instance have an IPv4-address on any interface. It would be very useful to have something similar to wait for the state/status to be "Ready".The startup script could set the state to ready when the services on the instance are running. Then terraform could wait for that and continue its work afterwards. In my case I want to contact kubernetes on the newly created instance from the
kubectl
terraform provider in the sameterraform apply
. It is currently not possible because terraform would see theincus_instance
as done before the kubernetes cluster on it is running and fail to apply the resources withkubectl
.Bug
When setting the state to "Ready" with the above
curl
call, a subsequentterraform apply
would show the following plan:And after confirming, would fail with:
My guess is that the line that sets the
running
-argument , should also considerapi.Ready
.Alternative
From the CLI the cloud-init status can be checked by
incus exec my-instance -- cloud-init status --wait
. With the proposedexec
from #86, I would expect terraform to wait for theexec
block to finish before moving on. It would then be trivial to just docloud-init status --wait
in anexec
block. Alternatively, I could just move all my functionality currently implemented with cloud-init to anexec
.Footnotes
I found this out from these fragmented documentation bits: 1, 2, 3, 4 ↩
The text was updated successfully, but these errors were encountered: