consul.getServices
Explore with Pulumi AI
The consul.getServices
data source returns a list of Consul services that
have been registered with the Consul cluster in a given datacenter. By
specifying a different datacenter in the query_options
it is possible to
retrieve a list of services from a different WAN-attached Consul datacenter.
This data source is different from the consul.Service
(singular) data
source, which provides a detailed response about a specific Consul service.
Using getServices
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getServices(args: GetServicesArgs, opts?: InvokeOptions): Promise<GetServicesResult>
function getServicesOutput(args: GetServicesOutputArgs, opts?: InvokeOptions): Output<GetServicesResult>
def get_services(query_options: Optional[Sequence[GetServicesQueryOption]] = None,
opts: Optional[InvokeOptions] = None) -> GetServicesResult
def get_services_output(query_options: Optional[pulumi.Input[Sequence[pulumi.Input[GetServicesQueryOptionArgs]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetServicesResult]
func GetServices(ctx *Context, args *GetServicesArgs, opts ...InvokeOption) (*GetServicesResult, error)
func GetServicesOutput(ctx *Context, args *GetServicesOutputArgs, opts ...InvokeOption) GetServicesResultOutput
> Note: This function is named GetServices
in the Go SDK.
public static class GetServices
{
public static Task<GetServicesResult> InvokeAsync(GetServicesArgs args, InvokeOptions? opts = null)
public static Output<GetServicesResult> Invoke(GetServicesInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetServicesResult> getServices(GetServicesArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: consul:index/getServices:getServices
arguments:
# arguments dictionary
The following arguments are supported:
- Query
Options List<GetServices Query Option> See below.
- Query
Options []GetServices Query Option See below.
- query
Options List<GetServices Query Option> See below.
- query
Options GetServices Query Option[] See below.
- query
Options List<Property Map> See below.
getServices Result
The following output properties are available:
- Datacenter string
The datacenter the keys are being read from to.
- Id string
The provider-assigned unique ID for this managed resource.
- Names List<string>
- Services Dictionary<string, string>
- Dictionary<string, string>
A map of the tags found for each service. If more than one service shares the same tag, unique service names will be joined by whitespace (this is the inverse of
services
and can be used to lookup the services that match a single tag).- Query
Options List<GetServices Query Option>
- Datacenter string
The datacenter the keys are being read from to.
- Id string
The provider-assigned unique ID for this managed resource.
- Names []string
- Services map[string]string
- map[string]string
A map of the tags found for each service. If more than one service shares the same tag, unique service names will be joined by whitespace (this is the inverse of
services
and can be used to lookup the services that match a single tag).- Query
Options []GetServices Query Option
- datacenter String
The datacenter the keys are being read from to.
- id String
The provider-assigned unique ID for this managed resource.
- names List<String>
- services Map<String,String>
- Map<String,String>
A map of the tags found for each service. If more than one service shares the same tag, unique service names will be joined by whitespace (this is the inverse of
services
and can be used to lookup the services that match a single tag).- query
Options List<GetServices Query Option>
- datacenter string
The datacenter the keys are being read from to.
- id string
The provider-assigned unique ID for this managed resource.
- names string[]
- services {[key: string]: string}
- {[key: string]: string}
A map of the tags found for each service. If more than one service shares the same tag, unique service names will be joined by whitespace (this is the inverse of
services
and can be used to lookup the services that match a single tag).- query
Options GetServices Query Option[]
- datacenter str
The datacenter the keys are being read from to.
- id str
The provider-assigned unique ID for this managed resource.
- names Sequence[str]
- services Mapping[str, str]
- Mapping[str, str]
A map of the tags found for each service. If more than one service shares the same tag, unique service names will be joined by whitespace (this is the inverse of
services
and can be used to lookup the services that match a single tag).- query_
options Sequence[GetServices Query Option]
- datacenter String
The datacenter the keys are being read from to.
- id String
The provider-assigned unique ID for this managed resource.
- names List<String>
- services Map<String>
- Map<String>
A map of the tags found for each service. If more than one service shares the same tag, unique service names will be joined by whitespace (this is the inverse of
services
and can be used to lookup the services that match a single tag).- query
Options List<Property Map>
Supporting Types
GetServicesQueryOption
- Allow
Stale bool When
true
, the default, allow responses from Consul servers that are followers.- Datacenter string
The Consul datacenter to query. Defaults to the same value found in
query_options
parameter specified below, or if that is empty, thedatacenter
value found in the Consul agent that this provider is configured to talk to.- Namespace string
The namespace to lookup the services.
- Near string
- Node
Meta Dictionary<string, string> - Partition string
- Require
Consistent bool When
true
force the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse
.- Token string
Specify the Consul ACL token to use when performing the request. This defaults to the same API token configured by the
consul
provider but may be overridden if necessary.- Wait
Index int Index number used to enable blocking queries.
- Wait
Time string Max time the client should wait for a blocking query to return.
- Allow
Stale bool When
true
, the default, allow responses from Consul servers that are followers.- Datacenter string
The Consul datacenter to query. Defaults to the same value found in
query_options
parameter specified below, or if that is empty, thedatacenter
value found in the Consul agent that this provider is configured to talk to.- Namespace string
The namespace to lookup the services.
- Near string
- Node
Meta map[string]string - Partition string
- Require
Consistent bool When
true
force the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse
.- Token string
Specify the Consul ACL token to use when performing the request. This defaults to the same API token configured by the
consul
provider but may be overridden if necessary.- Wait
Index int Index number used to enable blocking queries.
- Wait
Time string Max time the client should wait for a blocking query to return.
- allow
Stale Boolean When
true
, the default, allow responses from Consul servers that are followers.- datacenter String
The Consul datacenter to query. Defaults to the same value found in
query_options
parameter specified below, or if that is empty, thedatacenter
value found in the Consul agent that this provider is configured to talk to.- namespace String
The namespace to lookup the services.
- near String
- node
Meta Map<String,String> - partition String
- require
Consistent Boolean When
true
force the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse
.- token String
Specify the Consul ACL token to use when performing the request. This defaults to the same API token configured by the
consul
provider but may be overridden if necessary.- wait
Index Integer Index number used to enable blocking queries.
- wait
Time String Max time the client should wait for a blocking query to return.
- allow
Stale boolean When
true
, the default, allow responses from Consul servers that are followers.- datacenter string
The Consul datacenter to query. Defaults to the same value found in
query_options
parameter specified below, or if that is empty, thedatacenter
value found in the Consul agent that this provider is configured to talk to.- namespace string
The namespace to lookup the services.
- near string
- node
Meta {[key: string]: string} - partition string
- require
Consistent boolean When
true
force the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse
.- token string
Specify the Consul ACL token to use when performing the request. This defaults to the same API token configured by the
consul
provider but may be overridden if necessary.- wait
Index number Index number used to enable blocking queries.
- wait
Time string Max time the client should wait for a blocking query to return.
- allow_
stale bool When
true
, the default, allow responses from Consul servers that are followers.- datacenter str
The Consul datacenter to query. Defaults to the same value found in
query_options
parameter specified below, or if that is empty, thedatacenter
value found in the Consul agent that this provider is configured to talk to.- namespace str
The namespace to lookup the services.
- near str
- node_
meta Mapping[str, str] - partition str
- require_
consistent bool When
true
force the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse
.- token str
Specify the Consul ACL token to use when performing the request. This defaults to the same API token configured by the
consul
provider but may be overridden if necessary.- wait_
index int Index number used to enable blocking queries.
- wait_
time str Max time the client should wait for a blocking query to return.
- allow
Stale Boolean When
true
, the default, allow responses from Consul servers that are followers.- datacenter String
The Consul datacenter to query. Defaults to the same value found in
query_options
parameter specified below, or if that is empty, thedatacenter
value found in the Consul agent that this provider is configured to talk to.- namespace String
The namespace to lookup the services.
- near String
- node
Meta Map<String> - partition String
- require
Consistent Boolean When
true
force the client to perform a read on at least quorum servers and verify the result is the same. Defaults tofalse
.- token String
Specify the Consul ACL token to use when performing the request. This defaults to the same API token configured by the
consul
provider but may be overridden if necessary.- wait
Index Number Index number used to enable blocking queries.
- wait
Time String Max time the client should wait for a blocking query to return.
Package Details
- Repository
- HashiCorp Consul pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
consul
Terraform Provider.