Compose.yml.tpl for volume names

I need to use secrets that are only supported in compose v2+, but i have a problem with volume name.

With v1 i can specify a volume name variable to be filled per catalog:

And that’s very cool i can use volume name if using nfs or path if using local driver.

Unfortunately the new v2 way you have to specify the name in volumes so a thing like this:
Isn’t working anymore, cause i’m using a key as variable…
Is there any way to use the .tpl to avoid this problem?