{%- set workers = salt['pillar.get']('profile:matrix:workers') %}
{%- for app, types in workers.items() %}
{%- for type in types %}
{%- set worker_index = loop.index %}
{%- if type.get('rest') %}
{%- for uri in type.get('rest') %}
location ~ {{ uri }} {
proxy_pass http://{{ app }}_{{ worker_index }}$request_uri;
}
{%- endfor %}
{%- endif %}
{%- endfor %}
{%- endfor %}