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

     1  ---
     2  layout: "consul"
     3  page_title: "Consul: consul_catalog_service"
     4  sidebar_current: "docs-consul-data-source-catalog-service"
     5  description: |-
     6    Provides details about a specific Consul service
     7  ---
     8  
     9  # consul\_catalog\_service
    10  
    11  `consul_catalog_service` provides details about a specific Consul service in a
    12  given datacenter.  The results include a list of nodes advertising the specified
    13  service, the node's IP address, port number, node ID, etc.  By specifying a
    14  different datacenter in the `query_options` it is possible to retrieve a list of
    15  services from a different WAN-attached Consul datacenter.
    16  
    17  This data source is different from the `consul_catalog_services` (plural) data
    18  source, which provides a summary of the current Consul services.
    19  
    20  ## Example Usage
    21  
    22  ```
    23  data "consul_catalog_service" "read-consul-dc1" {
    24    # query_options {  #    # Optional parameter: implicitly uses the current datacenter of the agent  #    datacenter = "dc1"  # }
    25  
    26    name = "consul"
    27  }
    28  
    29  # Set the description to a whitespace delimited list of the node names
    30  resource "example_resource" "app" {
    31    description = "${join(" ", data.consul_catalog_service.nodes)}"
    32  
    33    # ...
    34  }
    35  ```
    36  
    37  ## Argument Reference
    38  
    39  The following arguments are supported:
    40  
    41  * `datacenter` - (Optional) The Consul datacenter to query.  Defaults to the
    42    same value found in `query_options` parameter specified below, or if that is
    43    empty, the `datacenter` value found in the Consul agent that this provider is
    44    configured to talk to.
    45  
    46  * `name` - (Required) The service name to select.
    47  
    48  * `query_options` - (Optional) See below.
    49  
    50  * `tag` - (Optional) A single tag that can be used to filter the list of nodes
    51    to return based on a single matching tag..
    52  
    53  The `query_options` block supports the following:
    54  
    55  * `allow_stale` - (Optional) When `true`, the default, allow responses from
    56    Consul servers that are followers.
    57  
    58  * `require_consistent` - (Optional) When `true` force the client to perform a
    59    read on at least quorum servers and verify the result is the same.  Defaults
    60    to `false`.
    61  
    62  * `token` - (Optional) Specify the Consul ACL token to use when performing the
    63    request.  This defaults to the same API token configured by the `consul`
    64    provider but may be overriden if necessary.
    65  
    66  * `wait_index` - (Optional) Index number used to enable blocking quereis.
    67  
    68  * `wait_time` - (Optional) Max time the client should wait for a blocking query
    69    to return.
    70  
    71  ## Attributes Reference
    72  
    73  The following attributes are exported:
    74  
    75  * `datacenter` - The datacenter the keys are being read from to.
    76  * `name` - The name of the service
    77  * `tag` - The name of the tag used to filter the list of nodes in `service`.
    78  * `service` - A list of nodes and details about each endpoint advertising a
    79    service.  Each element in the list is a map of attributes that correspond to
    80    each individual node.  The list of per-node attributes is detailed below.
    81  
    82  The following is a list of the per-node `service` attributes:
    83  
    84  * [`create_index`](https://www.consul.io/docs/agent/http/catalog.html#CreateIndex) -
    85    The index entry at which point this entry was added to the catalog.
    86  * [`modify_index`](https://www.consul.io/docs/agent/http/catalog.html#ModifyIndex) -
    87    The index entry at which point this entry was modified in the catalog.
    88  * [`node_address`](https://www.consul.io/docs/agent/http/catalog.html#Address) -
    89    The address of the Consul node advertising the service.
    90  * `node_id` - The Node ID of the Consul agent advertising the service.
    91  * [`node_meta`](https://www.consul.io/docs/agent/http/catalog.html#Meta) - Node
    92    meta data tag information, if any.
    93  * [`node_name`](https://www.consul.io/docs/agent/http/catalog.html#Node) - The
    94    name of the Consul node.
    95  * [`address`](https://www.consul.io/docs/agent/http/catalog.html#ServiceAddress) -
    96    The IP address of the service.  If the `ServiceAddress` in the Consul catalog
    97    is empty, this value is automatically populated with the `node_address` (the
    98    `Address` in the Consul Catalog).
    99  * [`enable_tag_override`](https://www.consul.io/docs/agent/http/catalog.html#ServiceEnableTagOverride) -
   100    Whether service tags can be overridden on this service.
   101  * [`id`](https://www.consul.io/docs/agent/http/catalog.html#ServiceID) - A
   102    unique service instance identifier.
   103  * [`name`](https://www.consul.io/docs/agent/http/catalog.html#ServiceName) - The
   104    name of the service.
   105  * [`port`](https://www.consul.io/docs/agent/http/catalog.html#ServicePort) -
   106    Port number of the service.
   107  * [`tagged_addresses`](https://www.consul.io/docs/agent/http/catalog.html#TaggedAddresses) -
   108    List of explicit LAN and WAN IP addresses for the agent.
   109  * [`tags`](https://www.consul.io/docs/agent/http/catalog.html#ServiceTags) -
   110    List of tags for the service.