Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

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 as tags 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 PreparedQueryDnsArgs

Settings for controlling the DNS response details.

Failover PreparedQueryFailoverArgs

Options for controlling behavior when no healthy nodes are available in the local DC.

IgnoreCheckIds List<string>

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.

NodeMeta 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.

OnlyPassing bool

When true, the prepared query will only return nodes with passing health checks in the result.

ServiceMeta 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.

StoredToken string

The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.

Tags 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 PreparedQueryTemplateArgs

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 as tags 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 PreparedQueryDns

Settings for controlling the DNS response details.

Failover PreparedQueryFailover

Options for controlling behavior when no healthy nodes are available in the local DC.

IgnoreCheckIds []string

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.

NodeMeta 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.

OnlyPassing bool

When true, the prepared query will only return nodes with passing health checks in the result.

ServiceMeta 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.

StoredToken string

The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.

Tags []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 PreparedQueryTemplate

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 as tags 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 PreparedQueryDns

Settings for controlling the DNS response details.

failover PreparedQueryFailover

Options for controlling behavior when no healthy nodes are available in the local DC.

ignoreCheckIds string[]

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.

nodeMeta {[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.

onlyPassing boolean

When true, the prepared query will only return nodes with passing health checks in the result.

serviceMeta {[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.

storedToken string

The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.

tags 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 PreparedQueryTemplate

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 as tags 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 PreparedQueryDnsArgs

Settings for controlling the DNS response details.

failover PreparedQueryFailoverArgs

Options for controlling behavior when no healthy nodes are available in the local DC.

ignore_check_ids Sequence[str]

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.

tags 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 PreparedQueryTemplateArgs

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 as tags 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 PreparedQueryDnsArgs

Settings for controlling the DNS response details.

Failover PreparedQueryFailoverArgs

Options for controlling behavior when no healthy nodes are available in the local DC.

IgnoreCheckIds List<string>

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.

NodeMeta 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.

OnlyPassing 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.

ServiceMeta 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.

StoredToken string

The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.

Tags 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 PreparedQueryTemplateArgs

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 as tags 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 PreparedQueryDns

Settings for controlling the DNS response details.

Failover PreparedQueryFailover

Options for controlling behavior when no healthy nodes are available in the local DC.

IgnoreCheckIds []string

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.

NodeMeta 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.

OnlyPassing 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.

ServiceMeta 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.

StoredToken string

The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.

Tags []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 PreparedQueryTemplate

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 as tags 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 PreparedQueryDns

Settings for controlling the DNS response details.

failover PreparedQueryFailover

Options for controlling behavior when no healthy nodes are available in the local DC.

ignoreCheckIds string[]

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.

nodeMeta {[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.

onlyPassing 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.

serviceMeta {[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.

storedToken string

The ACL token to store with the prepared query. This token will be used by default whenever the query is executed.

tags 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 PreparedQueryTemplate

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 as tags 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 PreparedQueryDnsArgs

Settings for controlling the DNS response details.

failover PreparedQueryFailoverArgs

Options for controlling behavior when no healthy nodes are available in the local DC.

ignore_check_ids Sequence[str]

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.

tags 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 PreparedQueryTemplateArgs

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.

NearestN int

Return results from this many datacenters, sorted in ascending order of estimated RTT.

Datacenters []string

Remote datacenters to return results from.

NearestN int

Return results from this many datacenters, sorted in ascending order of estimated RTT.

datacenters string[]

Remote datacenters to return results from.

nearestN 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

Regexp string

The regular expression to match with. When using name_prefix_match, this regex is applied against the query name.

Type string

The type of template matching to perform. Currently only name_prefix_match is supported.

Regexp string

The regular expression to match with. When using name_prefix_match, this regex is applied against the query name.

Type string

The type of template matching to perform. Currently only name_prefix_match is supported.

regexp string

The regular expression to match with. When using name_prefix_match, this regex is applied against the query name.

type string

The type of template matching to perform. Currently only name_prefix_match is supported.

regexp str

The regular expression to match with. When using name_prefix_match, this regex is applied against the query name.

type str

The type of template matching to perform. Currently only name_prefix_match is supported.

Package Details

Repository
https://github.com/pulumi/pulumi-consul
License
Apache-2.0
Notes
This Pulumi package is based on the consul Terraform Provider.