github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/website/source/docs/providers/consul/d/nodes.html.markdown (about)

     1  ---
     2  layout: "consul"
     3  page_title: "Consul: consul_catalog_nodes"
     4  sidebar_current: "docs-consul-data-source-catalog-nodes"
     5  description: |-
     6    Provides a list of nodes in a given Consul datacenter.
     7  ---
     8  
     9  # consul\_catalog\_nodes
    10  
    11  The `consul_catalog_nodes` data source returns a list of Consul nodes that have
    12  been registered with the Consul cluster in a given datacenter.  By specifying a
    13  different datacenter in the `query_options` it is possible to retrieve a list of
    14  nodes from a different WAN-attached Consul datacenter.
    15  
    16  ## Example Usage
    17  
    18  ```
    19  data "consul_catalog_nodes" "read-dc1-nodes" {
    20    # query_options {  #    # Optional parameter: implicitly uses the current datacenter of the agent  #    datacenter = "dc1"  # }
    21  }
    22  
    23  # Set the description to a whitespace delimited list of the node names
    24  resource "example_resource" "app" {
    25    description = "${join(" ", formatlist("%s", data.consul_catalog_nodes.node_names))}"
    26  
    27    # ...
    28  }
    29  ```
    30  
    31  ## Argument Reference
    32  
    33  The following arguments are supported:
    34  
    35  * `datacenter` - (Optional) The Consul datacenter to query.  Defaults to the
    36    same value found in `query_options` parameter specified below, or if that is
    37    empty, the `datacenter` value found in the Consul agent that this provider is
    38    configured to talk to.
    39  
    40  * `query_options` - (Optional) See below.
    41  
    42  The `query_options` block supports the following:
    43  
    44  * `allow_stale` - (Optional) When `true`, the default, allow responses from
    45    Consul servers that are followers.
    46  
    47  * `require_consistent` - (Optional) When `true` force the client to perform a
    48    read on at least quorum servers and verify the result is the same.  Defaults
    49    to `false`.
    50  
    51  * `token` - (Optional) Specify the Consul ACL token to use when performing the
    52    request.  This defaults to the same API token configured by the `consul`
    53    provider but may be overriden if necessary.
    54  
    55  * `wait_index` - (Optional) Index number used to enable blocking quereis.
    56  
    57  * `wait_time` - (Optional) Max time the client should wait for a blocking query
    58    to return.
    59  
    60  ## Attributes Reference
    61  
    62  The following attributes are exported:
    63  
    64  * `datacenter` - The datacenter the keys are being read from to.
    65  * `node_ids` - A list of the Consul node IDs.
    66  * `node_names` - A list of the Consul node names.
    67  * `nodes` - A list of nodes and details about each Consul agent.  The list of
    68    per-node attributes is detailed below.
    69  
    70  The following is a list of the per-node attributes contained within the `nodes`
    71  map:
    72  
    73  * `id` - The Node ID of the Consul agent.
    74  * [`meta`](https://www.consul.io/docs/agent/http/catalog.html#Meta) - Node meta
    75    data tag information, if any.
    76  * [`name`](https://www.consul.io/docs/agent/http/catalog.html#Node) - The name
    77    of the Consul node.
    78  * [`address`](https://www.consul.io/docs/agent/http/catalog.html#Address) - The
    79    IP address the node is advertising to the Consul cluster.
    80  * [`tagged_addresses`](https://www.consul.io/docs/agent/http/catalog.html#TaggedAddresses) -
    81    List of explicit LAN and WAN IP addresses for the agent.