从Vault KV值构建动态字符串

I'm trying to create something similar to this:

{{with secret "secret/data"}}
    {{range $k, $v := .Data}}
        {{if eq $k "db-primary"}}
            {{with $secret := secret "mysql-$v/creds/primary"}}
                {{$secret.username}}:{{$secret.password}}
            {{end}}
        {{end}}
    {{end}}
{{end}}

where $v is a dynamic value. I can't figure out how to have the nested with statement parse the vlaue of $v into its arguments.

I found the answer if anyone is looking to do something similar

{{with secret "secret/data"}}
    {{range $k, $v := .Data}}
        {{if eq $k "db-primary"}}
            {{with $secret := secret (printf "mysql-%s/creds/primary" $v)}}
                {{$secret.username}}:{{$secret.password}}
            {{end}}
        {{end}}
    {{end}}
{{end}}

using printf lets me replace and inject the value dynamically.