Terraform healthchecks

How can I define healthchecks in terraform?
I think it’s not possible yet, but that would mean the provider is not really useable, am I missing something?

Hi @Andreas_Thomas :wave:

By default, we perform a TCP health check on each port exposed to the service.

Custom health checks allow you to override the default TCP health check for each port to get more control over defining the health status of a service.

The option to define custom health checks should be available in the TF provider this week. I will make sure to let you know when it’s live!

:fire: awesome, thanks

apparently this message was too short, so I’m adding dummy text

1 Like

Available in the latest release. Let me know how are things going :wink:

Basic example to configure a minimalistic HTTP:

terraform {
  required_providers {
    koyeb = {
      source  = "koyeb/koyeb"
      version = "0.1.4"
    }
  }
}
provider "koyeb" {
}

resource "koyeb_app" "my-app" {
  name = var.app_name
}


resource "koyeb_service" "my-service" {
  app_name = var.app_name
  definition {
    name = var.service_name
    instance_types {
      type = "free"
    }
    ports {
      port     = 3000
      protocol = "http"
    }
    routes {
      path = "/"
      port = 3000
    }
    health_checks {
      http {
        port = 3000
        path = "/"
      }
    }
    scalings {
      min = 1
      max = 1
    }

    regions = ["fra"]
    docker {
      image = "koyeb/demo"
    }
  }

  depends_on = [
    koyeb_app.my-app
  ]
}