Terraform rookie here... Resouce groups... containers

Hello everyone!
This is my second week in the Terraform realm, and I must say, I am really enjoying.
:slight_smile:

I have stumped into an issue that I am, so far, not able to overcome.
I am trying to deploy 4 containers (A,B,C and D) to an ACI -Azure Container Instance- where containers B, C and D must wait for container A to be ready before starting.
I have checked Terraforms docs about it Terraform Registry.
I saw that there is a init_container option, which I plan to use to start my container A, but I cant find an example to guide me.
How to use that “init_container” in order to start container A and only then start the remaining ones?
Any help will be most welcome!
Thanks a lot!
Regards
Leo.

I knew nothing about Azure Container Instances before seeing your question, but it seems to mostly be an Azure-specific mash-up of Docker and Kubernetes concepts.

https://learn.microsoft.com/en-gb/azure/container-instances/container-instances-init-container:

Init containers run to completion before the application container or containers start.

That doesn’t seem to be what you want.

My best guess is that ACI does not support what you are looking for, and containers A, B, C, D will all start up concurrently, and must be prepared to deal with that themselves.

So when you say:

How exactly are you going to assess that readiness? I think this is a key point you need to think about independently from the orchestration platform you decide to use.

On Kubernetes, the initContainer concept is similar to what @maxb described. It’s whatever runs to completion before the application container(s) start.

If you have to wait for container A to reach a certain state, normally it would need to advertise that state to other containers or make that information available on an endpoint that others can query.

If you’re using a GitOps tool, like let’s say Flux, you can chain the deployment of a Kubernetes resource to the readiness state of another one (which can be assessed from the container’s readinessProbe, for example).

Probably none of that applies to your use-case, I’m just illustrating how those things are commonly done with other tools and hopefully it provides some insight that can be helpful.