PreparedQuery
Import
consul_prepared_query
can be imported with the query’s ID in the Consul HTTP API.
$ pulumi import consul:index/preparedQuery:PreparedQuery my_service 71ecfb82-717a-4258-b4b6-2fb75144d856
Create a PreparedQuery Resource
new PreparedQuery(name: string, args: PreparedQueryArgs, opts?: CustomResourceOptions);
def PreparedQuery(resource_name: str, opts: Optional[ResourceOptions] = None, connect: Optional[bool] = None, datacenter: Optional[str] = None, dns: Optional[PreparedQueryDnsArgs] = None, failover: Optional[PreparedQueryFailoverArgs] = None, ignore_check_ids: Optional[Sequence[str]] = None, name: Optional[str] = None, near: Optional[str] = None, node_meta: Optional[Mapping[str, str]] = None, only_passing: Optional[bool] = None, service: Optional[str] = None, service_meta: Optional[Mapping[str, str]] = None, session: Optional[str] = None, stored_token: Optional[str] = None, tags: Optional[Sequence[str]] = None, template: Optional[PreparedQueryTemplateArgs] = None, token: Optional[str] = None)
func NewPreparedQuery(ctx *Context, name string, args PreparedQueryArgs, opts ...ResourceOption) (*PreparedQuery, error)
public PreparedQuery(string name, PreparedQueryArgs args, CustomResourceOptions? opts = null)
- name string
- The unique name of the resource.
- args PreparedQueryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PreparedQueryArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PreparedQueryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
PreparedQuery Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The PreparedQuery resource accepts the following input properties:
- Service string
The name of the service to query.
- Connect bool
When
true
the prepared query will return connect proxy services for a queried service. Conditions such astags
in the prepared query will be matched against the proxy service. Defaults to false.- Datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- Dns
Prepared
Query Dns Args Settings for controlling the DNS response details.
- Failover
Prepared
Query Failover Args Options for controlling behavior when no healthy nodes are available in the local DC.
- Ignore
Check List<string>Ids Specifies a list of check IDs that should be ignored when filtering unhealthy instances. This is mostly useful in an emergency or as a temporary measure when a health check is found to be unreliable. Being able to ignore it in centrally-defined queries can be simpler than de-registering the check as an interim solution until the check can be fixed.
- Name string
The name of the prepared query. Used to identify the prepared query during requests. Can be specified as an empty string to configure the query as a catch-all.
- Near string
Allows specifying the name of a node to sort results near using Consul’s distance sorting and network coordinates. The magic
_agent
value can be used to always sort nearest the node servicing the request.- Node
Meta Dictionary<string, string> Specifies a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.
- Only
Passing bool When
true
, the prepared query will only return nodes with passing health checks in the result.- Service
Meta Dictionary<string, string> Specifies a list of user-defined key/value pairs that will be used for filtering the query results to services with the given metadata values present.
- Session string
The name of the Consul session to tie this query’s lifetime to. This is an advanced parameter that should not be used without a complete understanding of Consul sessions and the implications of their use (it is recommended to leave this blank in nearly all cases). If this parameter is omitted the query will not expire.
- Stored
Token string The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.
- List<string>
The list of required and/or disallowed tags. If a tag is in this list it must be present. If the tag is preceded with a “!” then it is disallowed.
- Template
Prepared
Query Template Args Query templating options. This is used to make a single prepared query respond to many different requests.
- Token string
The ACL token to use when saving the prepared query. This overrides the token that the agent provides by default.
- Service string
The name of the service to query.
- Connect bool
When
true
the prepared query will return connect proxy services for a queried service. Conditions such astags
in the prepared query will be matched against the proxy service. Defaults to false.- Datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- Dns
Prepared
Query Dns Settings for controlling the DNS response details.
- Failover
Prepared
Query Failover Options for controlling behavior when no healthy nodes are available in the local DC.
- Ignore
Check []stringIds Specifies a list of check IDs that should be ignored when filtering unhealthy instances. This is mostly useful in an emergency or as a temporary measure when a health check is found to be unreliable. Being able to ignore it in centrally-defined queries can be simpler than de-registering the check as an interim solution until the check can be fixed.
- Name string
The name of the prepared query. Used to identify the prepared query during requests. Can be specified as an empty string to configure the query as a catch-all.
- Near string
Allows specifying the name of a node to sort results near using Consul’s distance sorting and network coordinates. The magic
_agent
value can be used to always sort nearest the node servicing the request.- Node
Meta map[string]string Specifies a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.
- Only
Passing bool When
true
, the prepared query will only return nodes with passing health checks in the result.- Service
Meta map[string]string Specifies a list of user-defined key/value pairs that will be used for filtering the query results to services with the given metadata values present.
- Session string
The name of the Consul session to tie this query’s lifetime to. This is an advanced parameter that should not be used without a complete understanding of Consul sessions and the implications of their use (it is recommended to leave this blank in nearly all cases). If this parameter is omitted the query will not expire.
- Stored
Token string The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.
- []string
The list of required and/or disallowed tags. If a tag is in this list it must be present. If the tag is preceded with a “!” then it is disallowed.
- Template
Prepared
Query Template Query templating options. This is used to make a single prepared query respond to many different requests.
- Token string
The ACL token to use when saving the prepared query. This overrides the token that the agent provides by default.
- service string
The name of the service to query.
- connect boolean
When
true
the prepared query will return connect proxy services for a queried service. Conditions such astags
in the prepared query will be matched against the proxy service. Defaults to false.- datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- dns
Prepared
Query Dns Settings for controlling the DNS response details.
- failover
Prepared
Query Failover Options for controlling behavior when no healthy nodes are available in the local DC.
- ignore
Check string[]Ids Specifies a list of check IDs that should be ignored when filtering unhealthy instances. This is mostly useful in an emergency or as a temporary measure when a health check is found to be unreliable. Being able to ignore it in centrally-defined queries can be simpler than de-registering the check as an interim solution until the check can be fixed.
- name string
The name of the prepared query. Used to identify the prepared query during requests. Can be specified as an empty string to configure the query as a catch-all.
- near string
Allows specifying the name of a node to sort results near using Consul’s distance sorting and network coordinates. The magic
_agent
value can be used to always sort nearest the node servicing the request.- node
Meta {[key: string]: string} Specifies a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.
- only
Passing boolean When
true
, the prepared query will only return nodes with passing health checks in the result.- service
Meta {[key: string]: string} Specifies a list of user-defined key/value pairs that will be used for filtering the query results to services with the given metadata values present.
- session string
The name of the Consul session to tie this query’s lifetime to. This is an advanced parameter that should not be used without a complete understanding of Consul sessions and the implications of their use (it is recommended to leave this blank in nearly all cases). If this parameter is omitted the query will not expire.
- stored
Token string The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.
- string[]
The list of required and/or disallowed tags. If a tag is in this list it must be present. If the tag is preceded with a “!” then it is disallowed.
- template
Prepared
Query Template Query templating options. This is used to make a single prepared query respond to many different requests.
- token string
The ACL token to use when saving the prepared query. This overrides the token that the agent provides by default.
- service str
The name of the service to query.
- connect bool
When
true
the prepared query will return connect proxy services for a queried service. Conditions such astags
in the prepared query will be matched against the proxy service. Defaults to false.- datacenter str
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- dns
Prepared
Query Dns Args Settings for controlling the DNS response details.
- failover
Prepared
Query Failover Args Options for controlling behavior when no healthy nodes are available in the local DC.
- ignore_
check_ Sequence[str]ids Specifies a list of check IDs that should be ignored when filtering unhealthy instances. This is mostly useful in an emergency or as a temporary measure when a health check is found to be unreliable. Being able to ignore it in centrally-defined queries can be simpler than de-registering the check as an interim solution until the check can be fixed.
- name str
The name of the prepared query. Used to identify the prepared query during requests. Can be specified as an empty string to configure the query as a catch-all.
- near str
Allows specifying the name of a node to sort results near using Consul’s distance sorting and network coordinates. The magic
_agent
value can be used to always sort nearest the node servicing the request.- node_
meta Mapping[str, str] Specifies a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.
- only_
passing bool When
true
, the prepared query will only return nodes with passing health checks in the result.- service_
meta Mapping[str, str] Specifies a list of user-defined key/value pairs that will be used for filtering the query results to services with the given metadata values present.
- session str
The name of the Consul session to tie this query’s lifetime to. This is an advanced parameter that should not be used without a complete understanding of Consul sessions and the implications of their use (it is recommended to leave this blank in nearly all cases). If this parameter is omitted the query will not expire.
- stored_
token str The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.
- Sequence[str]
The list of required and/or disallowed tags. If a tag is in this list it must be present. If the tag is preceded with a “!” then it is disallowed.
- template
Prepared
Query Template Args Query templating options. This is used to make a single prepared query respond to many different requests.
- token str
The ACL token to use when saving the prepared query. This overrides the token that the agent provides by default.
Outputs
All input properties are implicitly available as output properties. Additionally, the PreparedQuery resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
Look up an Existing PreparedQuery Resource
Get an existing PreparedQuery resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: PreparedQueryState, opts?: CustomResourceOptions): PreparedQuery
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, connect: Optional[bool] = None, datacenter: Optional[str] = None, dns: Optional[PreparedQueryDnsArgs] = None, failover: Optional[PreparedQueryFailoverArgs] = None, ignore_check_ids: Optional[Sequence[str]] = None, name: Optional[str] = None, near: Optional[str] = None, node_meta: Optional[Mapping[str, str]] = None, only_passing: Optional[bool] = None, service: Optional[str] = None, service_meta: Optional[Mapping[str, str]] = None, session: Optional[str] = None, stored_token: Optional[str] = None, tags: Optional[Sequence[str]] = None, template: Optional[PreparedQueryTemplateArgs] = None, token: Optional[str] = None) -> PreparedQuery
func GetPreparedQuery(ctx *Context, name string, id IDInput, state *PreparedQueryState, opts ...ResourceOption) (*PreparedQuery, error)
public static PreparedQuery Get(string name, Input<string> id, PreparedQueryState? state, CustomResourceOptions? opts = null)
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Connect bool
When
true
the prepared query will return connect proxy services for a queried service. Conditions such astags
in the prepared query will be matched against the proxy service. Defaults to false.- Datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- Dns
Prepared
Query Dns Args Settings for controlling the DNS response details.
- Failover
Prepared
Query Failover Args Options for controlling behavior when no healthy nodes are available in the local DC.
- Ignore
Check List<string>Ids Specifies a list of check IDs that should be ignored when filtering unhealthy instances. This is mostly useful in an emergency or as a temporary measure when a health check is found to be unreliable. Being able to ignore it in centrally-defined queries can be simpler than de-registering the check as an interim solution until the check can be fixed.
- Name string
The name of the prepared query. Used to identify the prepared query during requests. Can be specified as an empty string to configure the query as a catch-all.
- Near string
Allows specifying the name of a node to sort results near using Consul’s distance sorting and network coordinates. The magic
_agent
value can be used to always sort nearest the node servicing the request.- Node
Meta Dictionary<string, string> Specifies a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.
- Only
Passing bool When
true
, the prepared query will only return nodes with passing health checks in the result.- Service string
The name of the service to query.
- Service
Meta Dictionary<string, string> Specifies a list of user-defined key/value pairs that will be used for filtering the query results to services with the given metadata values present.
- Session string
The name of the Consul session to tie this query’s lifetime to. This is an advanced parameter that should not be used without a complete understanding of Consul sessions and the implications of their use (it is recommended to leave this blank in nearly all cases). If this parameter is omitted the query will not expire.
- Stored
Token string The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.
- List<string>
The list of required and/or disallowed tags. If a tag is in this list it must be present. If the tag is preceded with a “!” then it is disallowed.
- Template
Prepared
Query Template Args Query templating options. This is used to make a single prepared query respond to many different requests.
- Token string
The ACL token to use when saving the prepared query. This overrides the token that the agent provides by default.
- Connect bool
When
true
the prepared query will return connect proxy services for a queried service. Conditions such astags
in the prepared query will be matched against the proxy service. Defaults to false.- Datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- Dns
Prepared
Query Dns Settings for controlling the DNS response details.
- Failover
Prepared
Query Failover Options for controlling behavior when no healthy nodes are available in the local DC.
- Ignore
Check []stringIds Specifies a list of check IDs that should be ignored when filtering unhealthy instances. This is mostly useful in an emergency or as a temporary measure when a health check is found to be unreliable. Being able to ignore it in centrally-defined queries can be simpler than de-registering the check as an interim solution until the check can be fixed.
- Name string
The name of the prepared query. Used to identify the prepared query during requests. Can be specified as an empty string to configure the query as a catch-all.
- Near string
Allows specifying the name of a node to sort results near using Consul’s distance sorting and network coordinates. The magic
_agent
value can be used to always sort nearest the node servicing the request.- Node
Meta map[string]string Specifies a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.
- Only
Passing bool When
true
, the prepared query will only return nodes with passing health checks in the result.- Service string
The name of the service to query.
- Service
Meta map[string]string Specifies a list of user-defined key/value pairs that will be used for filtering the query results to services with the given metadata values present.
- Session string
The name of the Consul session to tie this query’s lifetime to. This is an advanced parameter that should not be used without a complete understanding of Consul sessions and the implications of their use (it is recommended to leave this blank in nearly all cases). If this parameter is omitted the query will not expire.
- Stored
Token string The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.
- []string
The list of required and/or disallowed tags. If a tag is in this list it must be present. If the tag is preceded with a “!” then it is disallowed.
- Template
Prepared
Query Template Query templating options. This is used to make a single prepared query respond to many different requests.
- Token string
The ACL token to use when saving the prepared query. This overrides the token that the agent provides by default.
- connect boolean
When
true
the prepared query will return connect proxy services for a queried service. Conditions such astags
in the prepared query will be matched against the proxy service. Defaults to false.- datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- dns
Prepared
Query Dns Settings for controlling the DNS response details.
- failover
Prepared
Query Failover Options for controlling behavior when no healthy nodes are available in the local DC.
- ignore
Check string[]Ids Specifies a list of check IDs that should be ignored when filtering unhealthy instances. This is mostly useful in an emergency or as a temporary measure when a health check is found to be unreliable. Being able to ignore it in centrally-defined queries can be simpler than de-registering the check as an interim solution until the check can be fixed.
- name string
The name of the prepared query. Used to identify the prepared query during requests. Can be specified as an empty string to configure the query as a catch-all.
- near string
Allows specifying the name of a node to sort results near using Consul’s distance sorting and network coordinates. The magic
_agent
value can be used to always sort nearest the node servicing the request.- node
Meta {[key: string]: string} Specifies a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.
- only
Passing boolean When
true
, the prepared query will only return nodes with passing health checks in the result.- service string
The name of the service to query.
- service
Meta {[key: string]: string} Specifies a list of user-defined key/value pairs that will be used for filtering the query results to services with the given metadata values present.
- session string
The name of the Consul session to tie this query’s lifetime to. This is an advanced parameter that should not be used without a complete understanding of Consul sessions and the implications of their use (it is recommended to leave this blank in nearly all cases). If this parameter is omitted the query will not expire.
- stored
Token string The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.
- string[]
The list of required and/or disallowed tags. If a tag is in this list it must be present. If the tag is preceded with a “!” then it is disallowed.
- template
Prepared
Query Template Query templating options. This is used to make a single prepared query respond to many different requests.
- token string
The ACL token to use when saving the prepared query. This overrides the token that the agent provides by default.
- connect bool
When
true
the prepared query will return connect proxy services for a queried service. Conditions such astags
in the prepared query will be matched against the proxy service. Defaults to false.- datacenter str
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- dns
Prepared
Query Dns Args Settings for controlling the DNS response details.
- failover
Prepared
Query Failover Args Options for controlling behavior when no healthy nodes are available in the local DC.
- ignore_
check_ Sequence[str]ids Specifies a list of check IDs that should be ignored when filtering unhealthy instances. This is mostly useful in an emergency or as a temporary measure when a health check is found to be unreliable. Being able to ignore it in centrally-defined queries can be simpler than de-registering the check as an interim solution until the check can be fixed.
- name str
The name of the prepared query. Used to identify the prepared query during requests. Can be specified as an empty string to configure the query as a catch-all.
- near str
Allows specifying the name of a node to sort results near using Consul’s distance sorting and network coordinates. The magic
_agent
value can be used to always sort nearest the node servicing the request.- node_
meta Mapping[str, str] Specifies a list of user-defined key/value pairs that will be used for filtering the query results to nodes with the given metadata values present.
- only_
passing bool When
true
, the prepared query will only return nodes with passing health checks in the result.- service str
The name of the service to query.
- service_
meta Mapping[str, str] Specifies a list of user-defined key/value pairs that will be used for filtering the query results to services with the given metadata values present.
- session str
The name of the Consul session to tie this query’s lifetime to. This is an advanced parameter that should not be used without a complete understanding of Consul sessions and the implications of their use (it is recommended to leave this blank in nearly all cases). If this parameter is omitted the query will not expire.
- stored_
token str The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.
- Sequence[str]
The list of required and/or disallowed tags. If a tag is in this list it must be present. If the tag is preceded with a “!” then it is disallowed.
- template
Prepared
Query Template Args Query templating options. This is used to make a single prepared query respond to many different requests.
- token str
The ACL token to use when saving the prepared query. This overrides the token that the agent provides by default.
Supporting Types
PreparedQueryDns
- Ttl string
The TTL to send when returning DNS results.
- Ttl string
The TTL to send when returning DNS results.
- ttl string
The TTL to send when returning DNS results.
- ttl str
The TTL to send when returning DNS results.
PreparedQueryFailover
- Datacenters List<string>
Remote datacenters to return results from.
- Nearest
N int Return results from this many datacenters, sorted in ascending order of estimated RTT.
- Datacenters []string
Remote datacenters to return results from.
- Nearest
N int Return results from this many datacenters, sorted in ascending order of estimated RTT.
- datacenters string[]
Remote datacenters to return results from.
- nearest
N number Return results from this many datacenters, sorted in ascending order of estimated RTT.
- datacenters Sequence[str]
Remote datacenters to return results from.
- nearest_
n int Return results from this many datacenters, sorted in ascending order of estimated RTT.
PreparedQueryTemplate
Package Details
- Repository
- https://github.com/pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
consul
Terraform Provider.