Terraform - Wait until deployment completed

I am using Terraform to deploy to Koyeb.

In my pipeline I want to depoy, then start E2E test on the newly deployed environment.

What is the best way to wait until the deployment is completed?

The terraform provider seems to complete, when the deployment is started.

Used a little bit of bash during CI in the meanwhile:

sleep 10
DEPLOYMENT_ID=$(~/.koyeb/bin/koyeb service get web-app -a meet-isaac-staging --output json | jq -r '.state.desired_deployment.groups[0].deployment_ids[0]')
echo "Koyeb Deployment: $DEPLOYMENT_ID"
STATUS=$(~/.koyeb/bin/koyeb deployments get $DEPLOYMENT_ID --output json | jq -r '.status')
echo "Koyeb Deployment Status is $STATUS"
while [ $STATUS != "HEALTHY" ] && [ $STATUS != "STOPPED" ] && [ $STATUS != "ERROR" ] && [ $STATUS != "CANCELED" ]
do
  STATUS=$(~/.koyeb/bin/koyeb deployments get $DEPLOYMENT_ID --output json | jq -r '.status')
  sleep 5
done
echo "Koyeb Deployment Status is $STATUS"
if [ $STATUS != "HEALTHY" ]
  exit 1
fi

Hi @ggmueller,

You’re right, the Terraform provider doesn’t wait for the deployment to complete. That’s something I’d like to add, but I have no ETA at the moment.

Have you looked at this GitHub action that is waiting for the deployment to complete? I’m wondering if it could fit with your needs.

We are using CircleCI for CI/CD at the moment, so it is not an option.