Discovering Consul Connect-enabled services with consul template

Hi,

I would like to know how to discover Consul Connect enabled services with consul template. I have written Nomad jobs that do not use Consul Connect, and others that use Consul Connect. The others that use Consul Connect have Envoy sidecar proxies running. Nomad automatically register the service and its proxies to Consul.

Because it’s Connect enabled, is it possible to discover it from non-Connect network, for example Nomad jobs running with CNI plugin? My application does not support querying DNS SRV record. And because the port is dynamic (dynamically allocated by Nomad for the proxy), I need to somehow contact Consul and ask about the address of the proxy. Therefore, I think I may need to use consul template, but do not know how.

Thank You.