# How to Group different services that shares same tags

**URL:** <https://discuss.hashicorp.com/t/how-to-group-different-services-that-shares-same-tags/41844>\
**Category:** Consul\
**Created:** [July 11, 2022, 6:27pm UTC](https://discuss.hashicorp.com/t/how-to-group-different-services-that-shares-same-tags/41844 "2022-07-11T18:27:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsiamer](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/tsiamer/32/24422_2.png) [@tsiamer](https://discuss.hashicorp.com/u/tsiamer)\
**Post date:** [July 11, 2022, 6:27pm UTC](https://discuss.hashicorp.com/t/how-to-group-different-services-that-shares-same-tags/41844/1 "2022-07-11T18:27:51Z")

</div>

I would like to group consul service by tags, using the below:

{{range services}}  
{{range $tag, $services := service .Name | byTag }}  
{{if or (eq $tag “Volkswagen”) }}  
{{ range $services }}  
{{ $tag}}  
{{ .Name }}  
{{ end }}{{ end }}{{end}}{{end}}  
Output:

```
  Volkswagen
   Golf

  Volkswagen
   BUW

```

I d like it to be:

Volkswagen is the tag:

```
  Volkswagen

  Golf
  BUW

```

consul-template v0.29.0 (34ada7a)

Thanks
