HashiCorp Consul name resolution provider spec

    Hashicorp Consul is setup within the Dapr Configuration.

    Within the config, add a spec and set the component field to "consul".

    If you are using the Dapr sidecar to register your service to Consul then you will need the following configuration:

    Behaviour

    On init the Consul component either validates the connection to the configured (or default) agent or registers the service if configured to do so. The name resolution interface does not cater for an “on shutdown” pattern so consider this when using Dapr to register services to Consul as it does not deregister services.

    The component resolves target apps by filtering healthy services and looks for a DAPR_PORT in the metadata (key is configurable) in order to retrieve the Dapr sidecar port. Consul service.meta is used over so as to not interfere with existing Consul estates.

    The configuration spec is fixed to v1.3.0 of the Consul API

    Sample configurations

    Enabling it is then possible to customize the checks, tags and meta

    Configuring the advanced registration gives you full control over setting all the Consul properties possible when registering.

    HashiCorp offer in depth guides on how to setup Consul for different hosting models. Check out the