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