hashicorp/consul-template

Support Cluster Peering with Consul Template

Esity opened this issue · 1 comments

Esity commented

Currently, Consul Template supports querying across federation links to other datacenters but has no docs and appears to not support querying services from peering connections which seems silly

### `datacenters`
Query [Consul][consul] for all datacenters in its catalog.
```golang
{{ datacenters }}
```
For example:
```golang
{{ range datacenters }}
{{ . }}{{ end }}
```
renders
```text
dc1
dc2
```
An optional boolean can be specified which instructs Consul Template to ignore
datacenters which are inaccessible or do not have a current leader. Enabling
this option requires an O(N+1) operation and therefore is not recommended in
environments where performance is a factor.
```golang
// Ignores datacenters which are inaccessible
{{ datacenters true }}
```

I don't see a good reason on why we wouldn't add this in as a supported thing considering federation is going away
Example PR talking about querying consul via DNS for peering
https://github.com/hashicorp/consul/blob/3332f63c4c00592e186843df85df9a5d0241cf7b/website/content/docs/services/discovery/dns-static-lookups.mdx#L102-L110

blake commented

@Esity Support for listing peers and querying services from peers was implemented in #1822 and #1869, and is available in the recent releases of Consul template.