I'm trying to iterate over a service with multiple tagged versions, grabbing a load balanced weight value from the key value store based on the tag and putting that in the key request path but having no luck.
The key/value path is "test_service/1.x/lb_weight" and so far the snippet looks like this, it returns what looks like a working template but I get the string rather than the K/V response in my haproxy config file.
{{range $test_service := service "test_service"}}
{{range $tags := .Tags}}
{{$weight := print "{{key \"test_service/" $tags "/lb_weight\"}}"}}
server {{$test_service.Name}} {{$test_service.Address}}:{{$test_service.Port}} weight {{$weight}}
{{end}}
{{end}}
Response:
I'm running consul-template 0.6.0, any help much appreciated!