The consul_config_entry_service_resolver
resource configures a service resolver that creates named subsets of service instances and define their behavior when satisfying upstream requests.
resource "consul_config_entry_service_resolver" "web" {
name = "web"
default_subset = "v1"
connect_timeout = "15s"
subsets {
name = "v1"
filter = "Service.Meta.version == v1"
}
subsets {
name = "v2"
Filter = "Service.Meta.version == v2"
}
redirect {
service = "web"
datacenter = "dc2"
}
failover {
subset_name = "v2"
datacenters = ["dc2"]
}
failover {
subset_name = "*"
datacenters = ["dc3", "dc4"]
}
}
name
(String) Specifies a name for the configuration entry.connect_timeout
(String) Specifies the timeout duration for establishing new network connections to this service.default_subset
(String) Specifies a defined subset of service instances to use when no explicit subset is requested. If this parameter is not specified, Consul uses the unnamed default subset.failover
(Block Set) Specifies controls for rerouting traffic to an alternate pool of service instances if the target service fails. (see below for nested schema)load_balancer
(Block Set) Specifies the load balancing policy and configuration for services issuing requests to this upstream. (see below for nested schema)meta
(Map of String) Specifies key-value pairs to add to the KV store.namespace
(String) Specifies the namespace that the service resolver applies to.partition
(String) Specifies the admin partition that the service resolver applies to.redirect
(Block Set) Specifies redirect instructions for local service traffic so that services deployed to a different network location resolve the upstream request instead. (see below for nested schema)request_timeout
(String) Specifies the timeout duration for receiving an HTTP response from this service.subsets
(Block Set) Specifies names for custom service subsets and the conditions under which service instances belong to each subset. (see below for nested schema)id
(String) The ID of this resource.failover
Required:
subset_name
(String) Name of subset.Optional:
datacenters
(List of String) Specifies an ordered list of datacenters at the failover location to attempt connections to during a failover scenario. When Consul cannot establish a connection with the first datacenter in the list, it proceeds sequentially until establishing a connection with another datacenter.namespace
(String) Specifies the namespace at the failover location where the failover services are deployed.sameness_group
(String) Specifies the sameness group at the failover location where the failover services are deployed.service
(String) Specifies the name of the service to resolve at the failover location during a failover scenario.service_subset
(String) Specifies the name of a subset of service instances to resolve at the failover location during a failover scenario.targets
(Block List) Specifies a fixed list of failover targets to try during failover. This list can express complicated failover scenarios. (see below for nested schema)failover.targets
Optional:
datacenter
(String) Specifies the WAN federated datacenter to use for the failover target. If empty, the current datacenter is used.namespace
(String) Specifies the namespace to use for the failover target. If empty, the default namespace is used.partition
(String) Specifies the admin partition within the same datacenter to use for the failover target. If empty, the default partition is used.peer
(String) Specifies the destination cluster peer to resolve the target service name from.service
(String) Specifies the service name to use for the failover target. If empty, the current service name is used.service_subset
(String) Specifies the named subset to use for the failover target. If empty, the default subset for the requested service name is used.load_balancer
Optional:
hash_policies
(Block List) Specifies a list of hash policies to use for hashing load balancing algorithms. Consul evaluates hash policies individually and combines them so that identical lists result in the same hash. (see below for nested schema)least_request_config
(Block Set) Specifies configuration for the least_request policy type. (see below for nested schema)policy
(String) Specifies the type of load balancing policy for selecting a host.ring_hash_config
(Block Set) Specifies configuration for the ring_hash policy type. (see below for nested schema)load_balancer.hash_policies
Optional:
cookie_config
(Block Set) Specifies additional configuration options for the cookie hash policy type. (see below for nested schema)field
(String) Specifies the attribute type to hash on. You cannot specify the Field parameter if SourceIP is also configured.field_value
(String) Specifies the value to hash, such as a header name, cookie name, or a URL query parameter name.source_ip
(Boolean) Determines if the hash type should be source IP address.terminal
(Boolean) Determines if Consul should stop computing the hash when multiple hash policies are present.load_balancer.hash_policies.cookie_config
Optional:
path
(String) Specifies the path to set for the cookie.session
(Boolean) Directs Consul to generate a session cookie with no expiration.ttl
(String) Specifies the TTL for generated cookies. Cannot be specified for session cookies.load_balancer.least_request_config
Optional:
choice_count
(Number)load_balancer.ring_hash_config
Optional:
maximum_ring_size
(Number) Determines the maximum number of entries in the hash ring.minimum_ring_size
(Number) Determines the minimum number of entries in the hash ring.redirect
Optional:
datacenter
(String) Specifies the datacenter at the redirect’s destination that resolves local upstream requests.namespace
(String) Specifies the namespace at the redirect’s destination that resolves local upstream requests.partition
(String) Specifies the admin partition at the redirect’s destination that resolves local upstream requests.peer
(String) Specifies the cluster with an active cluster peering connection at the redirect’s destination that resolves local upstream requests.sameness_group
(String) Specifies the sameness group at the redirect’s destination that resolves local upstream requests.service
(String) Specifies the name of a service at the redirect’s destination that resolves local upstream requests.service_subset
(String) Specifies the name of a subset of services at the redirect’s destination that resolves local upstream requests. If empty, the default subset is used. If specified, you must also specify at least one of the following in the same Redirect map: Service, Namespace, andDatacenter.subsets
Required:
filter
(String) Specifies an expression that filters the DNS elements of service instances that belong to the subset. If empty, all healthy instances of a service are returned.name
(String) Name of subset.only_passing
(Boolean) Determines if instances that return a warning from a health check are allowed to resolve a request. When set to false, instances with passing and warning states are considered healthy. When set to true, only instances with a passing health check state are considered healthy.