Fix clashing loop variables in TemplateResource

There were two loops using "v" as a variable name.

Closes-bug: #1235077
Change-Id: I5198621ce724abe9638da4a7482ae6817bbd86e7
Merge "Fix clashing loop variables in TemplateResource"