github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/consul/d/services.html.markdown (about)

     1  ---
     2  layout: "consul"
     3  page_title: "Consul: consul_catalog_services"
     4  sidebar_current: "docs-consul-data-source-catalog-services"
     5  description: |-
     6    Provides a list of services in a given Consul datacenter.
     7  ---
     8  
     9  # consul_catalog_services
    10  
    11  The `consul_catalog_services` data source returns a list of Consul services that
    12  have been registered with the Consul cluster in a given datacenter.  By
    13  specifying a different datacenter in the `query_options` it is possible to
    14  retrieve a list of services from a different WAN-attached Consul datacenter.
    15  
    16  This data source is different from the `consul_catalog_service` (singular) data
    17  source, which provides a detailed response about a specific Consul service.
    18  
    19  ## Example Usage
    20  
    21  ```hcl
    22  data "consul_catalog_services" "read-dc1" {
    23    query_options {
    24      # Optional parameter: implicitly uses the current datacenter of the agent  
    25      datacenter = "dc1"
    26    }
    27  }
    28  
    29  # Set the description to a whitespace delimited list of the services
    30  resource "example_resource" "app" {
    31    description = "${join(" ", data.consul_catalog_services.names)}"
    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  * `query_options` - (Optional) See below.
    47  
    48  The `query_options` block supports the following:
    49  
    50  * `allow_stale` - (Optional) When `true`, the default, allow responses from
    51    Consul servers that are followers.
    52  
    53  * `require_consistent` - (Optional) When `true` force the client to perform a
    54    read on at least quorum servers and verify the result is the same.  Defaults
    55    to `false`.
    56  
    57  * `token` - (Optional) Specify the Consul ACL token to use when performing the
    58    request.  This defaults to the same API token configured by the `consul`
    59    provider but may be overriden if necessary.
    60  
    61  * `wait_index` - (Optional) Index number used to enable blocking quereis.
    62  
    63  * `wait_time` - (Optional) Max time the client should wait for a blocking query
    64    to return.
    65  
    66  ## Attributes Reference
    67  
    68  The following attributes are exported:
    69  
    70  * `datacenter` - The datacenter the keys are being read from to.
    71  * `names` - A list of the Consul services found.  This will always contain the
    72    list of services found.
    73  * `services.<service>` - For each name given, the corresponding attribute is a
    74    Terraform map of services and their tags.  The value is an alphanumerically
    75    sorted, whitespace delimited set of tags associated with the service.
    76  * `tags` - A map of the tags found for each service.  If more than one service
    77    shares the same tag, unique service names will be joined by whitespace (this
    78    is the inverse of `services` and can be used to lookup the services that match
    79    a single tag).