hashicorp/consul-template — pull request #100 by inean (2014-11-27 20:29:44+00:00)
Title: Add helper function (iter) to iterate over a range of integers

Go template doesn't provide an out of the box function to iterate over a range of integers. For example, it could be used on a nginx-site configuration file to dynamically provision backends when those backends are local to node and thus, not registered with consul.
```
...
upstream example {
{{with $s := key "/service/nginx//config" | parseJSON }}
{{range $i := iter $s.socket_id $s.pool_size}}
server unix:{{$s.socket_path}}_{{$i}}.sock{{end}} max_fails=3 slow_start=30s;
{{end}}
}
...
```