consul_services

The consul_services data source returns a list of Consul services that have been registered with the Consul cluster in a given datacenter. By specifying a different datacenter in the query_options it is possible to retrieve a list of services from a different WAN-attached Consul datacenter.

This data source is different from the consul_service (singular) data source, which provides a detailed response about a specific Consul service.

Example Usage

data "consul_services" "read-dc1" {
  query_options {
    # Optional parameter: implicitly uses the current datacenter of the agent
    datacenter = "dc1"
  }
}

# Set the description to a whitespace delimited list of the services
resource "example_resource" "app" {
  description = "${join(" ", data.consul_services.names)}"

  # ...
}

Argument Reference

The following arguments are supported:

The query_options block supports the following:

Attributes Reference

The following attributes are exported: