consul.getServiceHealth
Explore with Pulumi AI
consul.getServiceHealth
can be used to get the list of the instances that
are currently healthy, according to their associated health-checks.
The result includes the list of service instances, the node associated to each
instance and its health-checks.
This resource is likely to change as frequently as the health-checks are being updated, you should expect different results in a frequent basis.
Example Usage
Coming soon!
Coming soon!
Coming soon!
Coming soon!
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.consul.ConsulFunctions;
import com.pulumi.consul.inputs.GetServiceHealthArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var vault = ConsulFunctions.getServiceHealth(GetServiceHealthArgs.builder()
.service("vault")
.passing(true)
.build());
}
}
variables:
vault:
fn::invoke:
function: consul:getServiceHealth
arguments:
service: vault
passing: true
Using getServiceHealth
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 getServiceHealth(args: GetServiceHealthArgs, opts?: InvokeOptions): Promise<GetServiceHealthResult>
function getServiceHealthOutput(args: GetServiceHealthOutputArgs, opts?: InvokeOptions): Output<GetServiceHealthResult>
def get_service_health(datacenter: Optional[str] = None,
filter: Optional[str] = None,
name: Optional[str] = None,
near: Optional[str] = None,
node_meta: Optional[Mapping[str, str]] = None,
passing: Optional[bool] = None,
tag: Optional[str] = None,
wait_for: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetServiceHealthResult
def get_service_health_output(datacenter: Optional[pulumi.Input[str]] = None,
filter: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
near: Optional[pulumi.Input[str]] = None,
node_meta: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
passing: Optional[pulumi.Input[bool]] = None,
tag: Optional[pulumi.Input[str]] = None,
wait_for: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetServiceHealthResult]
func LookupServiceHealth(ctx *Context, args *LookupServiceHealthArgs, opts ...InvokeOption) (*LookupServiceHealthResult, error)
func LookupServiceHealthOutput(ctx *Context, args *LookupServiceHealthOutputArgs, opts ...InvokeOption) LookupServiceHealthResultOutput
> Note: This function is named LookupServiceHealth
in the Go SDK.
public static class GetServiceHealth
{
public static Task<GetServiceHealthResult> InvokeAsync(GetServiceHealthArgs args, InvokeOptions? opts = null)
public static Output<GetServiceHealthResult> Invoke(GetServiceHealthInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetServiceHealthResult> getServiceHealth(GetServiceHealthArgs args, InvokeOptions options)
public static Output<GetServiceHealthResult> getServiceHealth(GetServiceHealthArgs args, InvokeOptions options)
fn::invoke:
function: consul:index/getServiceHealth:getServiceHealth
arguments:
# arguments dictionary
The following arguments are supported:
- Name
This property is required. string - The service name to select.
- Datacenter string
- The Consul datacenter to query.
- Filter string
- A filter expression to refine the list of results, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/health#filtering-2.
- Near string
- Specifies a node name to sort the node list in ascending order based on the estimated round trip time from that node.
- Node
Meta Dictionary<string, string> - Filter the results to nodes with the specified key/value pairs.
- Passing bool
- Whether to return only nodes with all checks in the
passing state. Defaults to
true
. - Tag string
- A single tag that can be used to filter the list to return based on a single matching tag.
- Wait
For string
- Name
This property is required. string - The service name to select.
- Datacenter string
- The Consul datacenter to query.
- Filter string
- A filter expression to refine the list of results, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/health#filtering-2.
- Near string
- Specifies a node name to sort the node list in ascending order based on the estimated round trip time from that node.
- Node
Meta map[string]string - Filter the results to nodes with the specified key/value pairs.
- Passing bool
- Whether to return only nodes with all checks in the
passing state. Defaults to
true
. - Tag string
- A single tag that can be used to filter the list to return based on a single matching tag.
- Wait
For string
- name
This property is required. String - The service name to select.
- datacenter String
- The Consul datacenter to query.
- filter String
- A filter expression to refine the list of results, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/health#filtering-2.
- near String
- Specifies a node name to sort the node list in ascending order based on the estimated round trip time from that node.
- node
Meta Map<String,String> - Filter the results to nodes with the specified key/value pairs.
- passing Boolean
- Whether to return only nodes with all checks in the
passing state. Defaults to
true
. - tag String
- A single tag that can be used to filter the list to return based on a single matching tag.
- wait
For String
- name
This property is required. string - The service name to select.
- datacenter string
- The Consul datacenter to query.
- filter string
- A filter expression to refine the list of results, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/health#filtering-2.
- near string
- Specifies a node name to sort the node list in ascending order based on the estimated round trip time from that node.
- node
Meta {[key: string]: string} - Filter the results to nodes with the specified key/value pairs.
- passing boolean
- Whether to return only nodes with all checks in the
passing state. Defaults to
true
. - tag string
- A single tag that can be used to filter the list to return based on a single matching tag.
- wait
For string
- name
This property is required. str - The service name to select.
- datacenter str
- The Consul datacenter to query.
- filter str
- A filter expression to refine the list of results, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/health#filtering-2.
- near str
- Specifies a node name to sort the node list in ascending order based on the estimated round trip time from that node.
- node_
meta Mapping[str, str] - Filter the results to nodes with the specified key/value pairs.
- passing bool
- Whether to return only nodes with all checks in the
passing state. Defaults to
true
. - tag str
- A single tag that can be used to filter the list to return based on a single matching tag.
- wait_
for str
- name
This property is required. String - The service name to select.
- datacenter String
- The Consul datacenter to query.
- filter String
- A filter expression to refine the list of results, see https://www.consul.io/api-docs/features/filtering and https://www.consul.io/api-docs/health#filtering-2.
- near String
- Specifies a node name to sort the node list in ascending order based on the estimated round trip time from that node.
- node
Meta Map<String> - Filter the results to nodes with the specified key/value pairs.
- passing Boolean
- Whether to return only nodes with all checks in the
passing state. Defaults to
true
. - tag String
- A single tag that can be used to filter the list to return based on a single matching tag.
- wait
For String
getServiceHealth Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of this health-check.
- Results
List<Get
Service Health Result> - A list of entries and details about each endpoint advertising a
service. Each element in the list has three attributes:
node
,service
andchecks
. The list of the attributes of each one is detailed below. - Datacenter string
- The datacenter in which the node is running.
tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.
- Filter string
- Near string
- The node to which the result must be sorted to.
- Node
Meta Dictionary<string, string> - The list of metadata to filter the nodes.
- Passing bool
- Whether to return only nodes with all checks in the passing state.
- Tag string
- The name of the tag used to filter the list.
- Wait
For string
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The name of this health-check.
- Results
[]Get
Service Health Result - A list of entries and details about each endpoint advertising a
service. Each element in the list has three attributes:
node
,service
andchecks
. The list of the attributes of each one is detailed below. - Datacenter string
- The datacenter in which the node is running.
tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.
- Filter string
- Near string
- The node to which the result must be sorted to.
- Node
Meta map[string]string - The list of metadata to filter the nodes.
- Passing bool
- Whether to return only nodes with all checks in the passing state.
- Tag string
- The name of the tag used to filter the list.
- Wait
For string
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of this health-check.
- results
List<Get
Service Health Result> - A list of entries and details about each endpoint advertising a
service. Each element in the list has three attributes:
node
,service
andchecks
. The list of the attributes of each one is detailed below. - datacenter String
- The datacenter in which the node is running.
tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.
- filter String
- near String
- The node to which the result must be sorted to.
- node
Meta Map<String,String> - The list of metadata to filter the nodes.
- passing Boolean
- Whether to return only nodes with all checks in the passing state.
- tag String
- The name of the tag used to filter the list.
- wait
For String
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The name of this health-check.
- results
Get
Service Health Result[] - A list of entries and details about each endpoint advertising a
service. Each element in the list has three attributes:
node
,service
andchecks
. The list of the attributes of each one is detailed below. - datacenter string
- The datacenter in which the node is running.
tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.
- filter string
- near string
- The node to which the result must be sorted to.
- node
Meta {[key: string]: string} - The list of metadata to filter the nodes.
- passing boolean
- Whether to return only nodes with all checks in the passing state.
- tag string
- The name of the tag used to filter the list.
- wait
For string
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The name of this health-check.
- results
Sequence[Get
Service Health Result] - A list of entries and details about each endpoint advertising a
service. Each element in the list has three attributes:
node
,service
andchecks
. The list of the attributes of each one is detailed below. - datacenter str
- The datacenter in which the node is running.
tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.
- filter str
- near str
- The node to which the result must be sorted to.
- node_
meta Mapping[str, str] - The list of metadata to filter the nodes.
- passing bool
- Whether to return only nodes with all checks in the passing state.
- tag str
- The name of the tag used to filter the list.
- wait_
for str
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The name of this health-check.
- results List<Property Map>
- A list of entries and details about each endpoint advertising a
service. Each element in the list has three attributes:
node
,service
andchecks
. The list of the attributes of each one is detailed below. - datacenter String
- The datacenter in which the node is running.
tagged_addresses
- List of explicit LAN and WAN IP addresses for the agent.
- filter String
- near String
- The node to which the result must be sorted to.
- node
Meta Map<String> - The list of metadata to filter the nodes.
- passing Boolean
- Whether to return only nodes with all checks in the passing state.
- tag String
- The name of the tag used to filter the list.
- wait
For String
Supporting Types
GetServiceHealthResult
- Checks
This property is required. List<GetService Health Result Check> - Nodes
This property is required. List<GetService Health Result Node> - The name of the node associated with this health-check.
- Services
This property is required. List<GetService Health Result Service>
- Checks
This property is required. []GetService Health Result Check - Nodes
This property is required. []GetService Health Result Node - The name of the node associated with this health-check.
- Services
This property is required. []GetService Health Result Service
- checks
This property is required. List<GetService Health Result Check> - nodes
This property is required. List<GetService Health Result Node> - The name of the node associated with this health-check.
- services
This property is required. List<GetService Health Result Service>
- checks
This property is required. GetService Health Result Check[] - nodes
This property is required. GetService Health Result Node[] - The name of the node associated with this health-check.
- services
This property is required. GetService Health Result Service[]
- checks
This property is required. Sequence[GetService Health Result Check] - nodes
This property is required. Sequence[GetService Health Result Node] - The name of the node associated with this health-check.
- services
This property is required. Sequence[GetService Health Result Service]
- checks
This property is required. List<Property Map> - nodes
This property is required. List<Property Map> - The name of the node associated with this health-check.
- services
This property is required. List<Property Map>
GetServiceHealthResultCheck
- Id
This property is required. string - The ID of this health-check.
- Name
This property is required. string - The service name to select.
- Node
This property is required. string - The name of the node associated with this health-check.
- Notes
This property is required. string - A human readable description of the current state of the health-check.
- Output
This property is required. string - The output of the health-check.
- Service
Id This property is required. string - The ID of the service associated to this health-check.
- Service
Name This property is required. string - The name of the service associated with this health-check.
This property is required. List<string>- The list of tags associated with this health-check.
- Status
This property is required. string - The status of this health-check.
- Id
This property is required. string - The ID of this health-check.
- Name
This property is required. string - The service name to select.
- Node
This property is required. string - The name of the node associated with this health-check.
- Notes
This property is required. string - A human readable description of the current state of the health-check.
- Output
This property is required. string - The output of the health-check.
- Service
Id This property is required. string - The ID of the service associated to this health-check.
- Service
Name This property is required. string - The name of the service associated with this health-check.
This property is required. []string- The list of tags associated with this health-check.
- Status
This property is required. string - The status of this health-check.
- id
This property is required. String - The ID of this health-check.
- name
This property is required. String - The service name to select.
- node
This property is required. String - The name of the node associated with this health-check.
- notes
This property is required. String - A human readable description of the current state of the health-check.
- output
This property is required. String - The output of the health-check.
- service
Id This property is required. String - The ID of the service associated to this health-check.
- service
Name This property is required. String - The name of the service associated with this health-check.
This property is required. List<String>- The list of tags associated with this health-check.
- status
This property is required. String - The status of this health-check.
- id
This property is required. string - The ID of this health-check.
- name
This property is required. string - The service name to select.
- node
This property is required. string - The name of the node associated with this health-check.
- notes
This property is required. string - A human readable description of the current state of the health-check.
- output
This property is required. string - The output of the health-check.
- service
Id This property is required. string - The ID of the service associated to this health-check.
- service
Name This property is required. string - The name of the service associated with this health-check.
This property is required. string[]- The list of tags associated with this health-check.
- status
This property is required. string - The status of this health-check.
- id
This property is required. str - The ID of this health-check.
- name
This property is required. str - The service name to select.
- node
This property is required. str - The name of the node associated with this health-check.
- notes
This property is required. str - A human readable description of the current state of the health-check.
- output
This property is required. str - The output of the health-check.
- service_
id This property is required. str - The ID of the service associated to this health-check.
- service_
name This property is required. str - The name of the service associated with this health-check.
This property is required. Sequence[str]- The list of tags associated with this health-check.
- status
This property is required. str - The status of this health-check.
- id
This property is required. String - The ID of this health-check.
- name
This property is required. String - The service name to select.
- node
This property is required. String - The name of the node associated with this health-check.
- notes
This property is required. String - A human readable description of the current state of the health-check.
- output
This property is required. String - The output of the health-check.
- service
Id This property is required. String - The ID of the service associated to this health-check.
- service
Name This property is required. String - The name of the service associated with this health-check.
This property is required. List<String>- The list of tags associated with this health-check.
- status
This property is required. String - The status of this health-check.
GetServiceHealthResultNode
- Address
This property is required. string - The address of this instance.
- Datacenter
This property is required. string - The Consul datacenter to query.
- Id
This property is required. string - The ID of this health-check.
- Meta
This property is required. Dictionary<string, string> - Service metadata tag information, if any.
- Name
This property is required. string - The service name to select.
- Tagged
Addresses This property is required. Dictionary<string, string>
- Address
This property is required. string - The address of this instance.
- Datacenter
This property is required. string - The Consul datacenter to query.
- Id
This property is required. string - The ID of this health-check.
- Meta
This property is required. map[string]string - Service metadata tag information, if any.
- Name
This property is required. string - The service name to select.
- Tagged
Addresses This property is required. map[string]string
- address
This property is required. String - The address of this instance.
- datacenter
This property is required. String - The Consul datacenter to query.
- id
This property is required. String - The ID of this health-check.
- meta
This property is required. Map<String,String> - Service metadata tag information, if any.
- name
This property is required. String - The service name to select.
- tagged
Addresses This property is required. Map<String,String>
- address
This property is required. string - The address of this instance.
- datacenter
This property is required. string - The Consul datacenter to query.
- id
This property is required. string - The ID of this health-check.
- meta
This property is required. {[key: string]: string} - Service metadata tag information, if any.
- name
This property is required. string - The service name to select.
- tagged
Addresses This property is required. {[key: string]: string}
- address
This property is required. str - The address of this instance.
- datacenter
This property is required. str - The Consul datacenter to query.
- id
This property is required. str - The ID of this health-check.
- meta
This property is required. Mapping[str, str] - Service metadata tag information, if any.
- name
This property is required. str - The service name to select.
- tagged_
addresses This property is required. Mapping[str, str]
- address
This property is required. String - The address of this instance.
- datacenter
This property is required. String - The Consul datacenter to query.
- id
This property is required. String - The ID of this health-check.
- meta
This property is required. Map<String> - Service metadata tag information, if any.
- name
This property is required. String - The service name to select.
- tagged
Addresses This property is required. Map<String>
GetServiceHealthResultService
- Address
This property is required. string - The address of this instance.
- Id
This property is required. string - The ID of this health-check.
- Meta
This property is required. Dictionary<string, string> - Service metadata tag information, if any.
- Name
This property is required. string - The service name to select.
- Port
This property is required. int - The port of this instance.
This property is required. List<string>- The list of tags associated with this instance.
- Address
This property is required. string - The address of this instance.
- Id
This property is required. string - The ID of this health-check.
- Meta
This property is required. map[string]string - Service metadata tag information, if any.
- Name
This property is required. string - The service name to select.
- Port
This property is required. int - The port of this instance.
This property is required. []string- The list of tags associated with this instance.
- address
This property is required. String - The address of this instance.
- id
This property is required. String - The ID of this health-check.
- meta
This property is required. Map<String,String> - Service metadata tag information, if any.
- name
This property is required. String - The service name to select.
- port
This property is required. Integer - The port of this instance.
This property is required. List<String>- The list of tags associated with this instance.
- address
This property is required. string - The address of this instance.
- id
This property is required. string - The ID of this health-check.
- meta
This property is required. {[key: string]: string} - Service metadata tag information, if any.
- name
This property is required. string - The service name to select.
- port
This property is required. number - The port of this instance.
This property is required. string[]- The list of tags associated with this instance.
- address
This property is required. str - The address of this instance.
- id
This property is required. str - The ID of this health-check.
- meta
This property is required. Mapping[str, str] - Service metadata tag information, if any.
- name
This property is required. str - The service name to select.
- port
This property is required. int - The port of this instance.
This property is required. Sequence[str]- The list of tags associated with this instance.
- address
This property is required. String - The address of this instance.
- id
This property is required. String - The ID of this health-check.
- meta
This property is required. Map<String> - Service metadata tag information, if any.
- name
This property is required. String - The service name to select.
- port
This property is required. Number - The port of this instance.
This property is required. List<String>- The list of tags associated with this instance.
Package Details
- Repository
- HashiCorp Consul pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
consul
Terraform Provider.