consul_nodes

The consul_nodes data source returns a list of Consul nodes 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 nodes from a different WAN-attached Consul datacenter.

Example Usage

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

# Set the description to a whitespace delimited list of the node names
resource "example_resource" "app" {
  description = "${join(" ", formatlist("%s", data.consul_nodes.node_names))}"

  # ...
}

Argument Reference

The following arguments are supported:

The query_options block supports the following:

Attributes Reference

The following attributes are exported:

The following is a list of the per-node attributes contained within the nodes map: