consul.getService
Explore with Pulumi AI
consul.Service
provides details about a specific Consul service in a
given datacenter. The results include a list of nodes advertising the specified
service, the node’s IP address, port number, node ID, etc. 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.getServices
(plural) data
source, which provides a summary of the current Consul services.
Using getService
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 getService(args: GetServiceArgs, opts?: InvokeOptions): Promise<GetServiceResult>
function getServiceOutput(args: GetServiceOutputArgs, opts?: InvokeOptions): Output<GetServiceResult>
def get_service(datacenter: Optional[str] = None,
filter: Optional[str] = None,
name: Optional[str] = None,
query_options: Optional[Sequence[GetServiceQueryOption]] = None,
tag: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetServiceResult
def get_service_output(datacenter: Optional[pulumi.Input[str]] = None,
filter: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
query_options: Optional[pulumi.Input[Sequence[pulumi.Input[GetServiceQueryOptionArgs]]]] = None,
tag: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetServiceResult]
func LookupService(ctx *Context, args *LookupServiceArgs, opts ...InvokeOption) (*LookupServiceResult, error)
func LookupServiceOutput(ctx *Context, args *LookupServiceOutputArgs, opts ...InvokeOption) LookupServiceResultOutput
> Note: This function is named LookupService
in the Go SDK.
public static class GetService
{
public static Task<GetServiceResult> InvokeAsync(GetServiceArgs args, InvokeOptions? opts = null)
public static Output<GetServiceResult> Invoke(GetServiceInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetServiceResult> getService(GetServiceArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: consul:index/getService:getService
arguments:
# arguments dictionary
The following arguments are supported:
- Name string
- The service name to select.
- 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. - Filter string
- A filter expression to refine the query, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/catalog#filtering-1.
- Query
Options List<GetService Query Option> - See below.
- Tag string
- A single tag that can be used to filter the list of nodes to return based on a single matching tag..
- Name string
- The service name to select.
- 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. - Filter string
- A filter expression to refine the query, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/catalog#filtering-1.
- Query
Options []GetService Query Option - See below.
- Tag string
- A single tag that can be used to filter the list of nodes to return based on a single matching tag..
- name String
- The service name to select.
- 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. - filter String
- A filter expression to refine the query, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/catalog#filtering-1.
- query
Options List<GetService Query Option> - See below.
- tag String
- A single tag that can be used to filter the list of nodes to return based on a single matching tag..
- name string
- The service name to select.
- 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. - filter string
- A filter expression to refine the query, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/catalog#filtering-1.
- query
Options GetService Query Option[] - See below.
- tag string
- A single tag that can be used to filter the list of nodes to return based on a single matching tag..
- name str
- The service name to select.
- 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. - filter str
- A filter expression to refine the query, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/catalog#filtering-1.
- query_
options Sequence[GetService Query Option] - See below.
- tag str
- A single tag that can be used to filter the list of nodes to return based on a single matching tag..
- name String
- The service name to select.
- 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. - filter String
- A filter expression to refine the query, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/catalog#filtering-1.
- query
Options List<Property Map> - See below.
- tag String
- A single tag that can be used to filter the list of nodes to return based on a single matching tag..
getService Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the service
- Services
List<Get
Service Service> - A list of nodes and details about each endpoint advertising a service. Each element in the list is a map of attributes that correspond to each individual node. The list of per-node attributes is detailed below.
- Datacenter string
- The datacenter the keys are being read from to.
- Filter string
- Query
Options List<GetService Query Option> - Tag string
- The name of the tag used to filter the list of nodes in
service
.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of the service
- Services
[]Get
Service Service - A list of nodes and details about each endpoint advertising a service. Each element in the list is a map of attributes that correspond to each individual node. The list of per-node attributes is detailed below.
- Datacenter string
- The datacenter the keys are being read from to.
- Filter string
- Query
Options []GetService Query Option - Tag string
- The name of the tag used to filter the list of nodes in
service
.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the service
- services
List<Get
Service Service> - A list of nodes and details about each endpoint advertising a service. Each element in the list is a map of attributes that correspond to each individual node. The list of per-node attributes is detailed below.
- datacenter String
- The datacenter the keys are being read from to.
- filter String
- query
Options List<GetService Query Option> - tag String
- The name of the tag used to filter the list of nodes in
service
.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The name of the service
- services
Get
Service Service[] - A list of nodes and details about each endpoint advertising a service. Each element in the list is a map of attributes that correspond to each individual node. The list of per-node attributes is detailed below.
- datacenter string
- The datacenter the keys are being read from to.
- filter string
- query
Options GetService Query Option[] - tag string
- The name of the tag used to filter the list of nodes in
service
.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The name of the service
- services
Sequence[Get
Service Service] - A list of nodes and details about each endpoint advertising a service. Each element in the list is a map of attributes that correspond to each individual node. The list of per-node attributes is detailed below.
- datacenter str
- The datacenter the keys are being read from to.
- filter str
- query_
options Sequence[GetService Query Option] - tag str
- The name of the tag used to filter the list of nodes in
service
.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of the service
- services List<Property Map>
- A list of nodes and details about each endpoint advertising a service. Each element in the list is a map of attributes that correspond to each individual node. The list of per-node attributes is detailed below.
- datacenter String
- The datacenter the keys are being read from to.
- filter String
- query
Options List<Property Map> - tag String
- The name of the tag used to filter the list of nodes in
service
.
Supporting Types
GetServiceQueryOption
- 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 service.
- 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 service.
- 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 service.
- 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 service.
- 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 service.
- 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 service.
- 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.
GetServiceService
- Address string
- Create
Index string - Enable
Tag stringOverride - Id string
- Meta Dictionary<string, string>
- Modify
Index string - Name string
- The service name to select.
- Node
Address string - Node
Id string - The Node ID of the Consul agent advertising the service.
node_meta
- Node meta data tag information, if any.node_name
- The name of the Consul node.address
- The IP address of the service. If theServiceAddress
in the Consul catalog is empty, this value is automatically populated with thenode_address
(theAddress
in the Consul Catalog).enable_tag_override
- Whether service tags can be overridden on this service.id
- A unique service instance identifier.name
- The name of the service.port
- Port number of the service.tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.tags
- List of tags for the service.meta
- Service meta data tag information, if any.
- Node
Meta Dictionary<string, string> - Node
Name string - Port string
- Tagged
Addresses Dictionary<string, string> - List<string>
- Address string
- Create
Index string - Enable
Tag stringOverride - Id string
- Meta map[string]string
- Modify
Index string - Name string
- The service name to select.
- Node
Address string - Node
Id string - The Node ID of the Consul agent advertising the service.
node_meta
- Node meta data tag information, if any.node_name
- The name of the Consul node.address
- The IP address of the service. If theServiceAddress
in the Consul catalog is empty, this value is automatically populated with thenode_address
(theAddress
in the Consul Catalog).enable_tag_override
- Whether service tags can be overridden on this service.id
- A unique service instance identifier.name
- The name of the service.port
- Port number of the service.tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.tags
- List of tags for the service.meta
- Service meta data tag information, if any.
- Node
Meta map[string]string - Node
Name string - Port string
- Tagged
Addresses map[string]string - []string
- address String
- create
Index String - enable
Tag StringOverride - id String
- meta Map<String,String>
- modify
Index String - name String
- The service name to select.
- node
Address String - node
Id String - The Node ID of the Consul agent advertising the service.
node_meta
- Node meta data tag information, if any.node_name
- The name of the Consul node.address
- The IP address of the service. If theServiceAddress
in the Consul catalog is empty, this value is automatically populated with thenode_address
(theAddress
in the Consul Catalog).enable_tag_override
- Whether service tags can be overridden on this service.id
- A unique service instance identifier.name
- The name of the service.port
- Port number of the service.tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.tags
- List of tags for the service.meta
- Service meta data tag information, if any.
- node
Meta Map<String,String> - node
Name String - port String
- tagged
Addresses Map<String,String> - List<String>
- address string
- create
Index string - enable
Tag stringOverride - id string
- meta {[key: string]: string}
- modify
Index string - name string
- The service name to select.
- node
Address string - node
Id string - The Node ID of the Consul agent advertising the service.
node_meta
- Node meta data tag information, if any.node_name
- The name of the Consul node.address
- The IP address of the service. If theServiceAddress
in the Consul catalog is empty, this value is automatically populated with thenode_address
(theAddress
in the Consul Catalog).enable_tag_override
- Whether service tags can be overridden on this service.id
- A unique service instance identifier.name
- The name of the service.port
- Port number of the service.tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.tags
- List of tags for the service.meta
- Service meta data tag information, if any.
- node
Meta {[key: string]: string} - node
Name string - port string
- tagged
Addresses {[key: string]: string} - string[]
- address str
- create_
index str - enable_
tag_ stroverride - id str
- meta Mapping[str, str]
- modify_
index str - name str
- The service name to select.
- node_
address str - node_
id str - The Node ID of the Consul agent advertising the service.
node_meta
- Node meta data tag information, if any.node_name
- The name of the Consul node.address
- The IP address of the service. If theServiceAddress
in the Consul catalog is empty, this value is automatically populated with thenode_address
(theAddress
in the Consul Catalog).enable_tag_override
- Whether service tags can be overridden on this service.id
- A unique service instance identifier.name
- The name of the service.port
- Port number of the service.tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.tags
- List of tags for the service.meta
- Service meta data tag information, if any.
- node_
meta Mapping[str, str] - node_
name str - port str
- tagged_
addresses Mapping[str, str] - Sequence[str]
- address String
- create
Index String - enable
Tag StringOverride - id String
- meta Map<String>
- modify
Index String - name String
- The service name to select.
- node
Address String - node
Id String - The Node ID of the Consul agent advertising the service.
node_meta
- Node meta data tag information, if any.node_name
- The name of the Consul node.address
- The IP address of the service. If theServiceAddress
in the Consul catalog is empty, this value is automatically populated with thenode_address
(theAddress
in the Consul Catalog).enable_tag_override
- Whether service tags can be overridden on this service.id
- A unique service instance identifier.name
- The name of the service.port
- Port number of the service.tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.tags
- List of tags for the service.meta
- Service meta data tag information, if any.
- node
Meta Map<String> - node
Name String - port String
- tagged
Addresses Map<String> - List<String>
Package Details
- Repository
- HashiCorp Consul pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
consul
Terraform Provider.