consul_service_health

consul_service_health can be used to get the list of the instances that are currently healthy, according to their associated health-checks. The result includes the list of service instances, the node associated to each instance and its health-checks.

This resource is likely to change as frequently as the health-checks are being updated, you should expect different results in a frequent basis.

Example Usage

provider "consul" {}

data "consul_service_health" "vault" {
  service = "vault"
  passing = true
}

provider "vault" {
  address = "https://${data.consul_service_health.vault.results.0.service.0.address}:${data.consul_service_health.vault.results.0.service.0.port}"
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

The following is a list of the per-entry node attributes:

The following is a list of the per-entry service attributes:

checks is a list of the health-checks associated to the entry with the following attributes: