github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/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  ```
    22  data "consul_catalog_services" "read-dc1" {
    23    # query_options {  #    # Optional parameter: implicitly uses the current datacenter of the agent  #    datacenter = "dc1"  # }
    24  }
    25  
    26  # Set the description to a whitespace delimited list of the services
    27  resource "example_resource" "app" {
    28    description = "${join(" ", data.consul_catalog_services.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  * `names` - A list of the Consul services found.  This will always contain the
    69    list of services found.
    70  * `services.<service>` - For each name given, the corresponding attribute is a
    71    Terraform map of services and their tags.  The value is an alphanumerically
    72    sorted, whitespace delimited set of tags associated with the service.
    73  * `tags` - A map of the tags found for each service.  If more than one service
    74    shares the same tag, unique service names will be joined by whitespace (this
    75    is the inverse of `services` and can be used to lookup the services that match
    76    a single tag).