Username Templating Data Fields - Snowflake

Hi,

I’m trying to make use of the username templates in the database engine. In the Username Templating docs, there is reference to the data fields available in templating:

Each secret engine provides a different set of data to the template. Please see the associated secret engine’s documentation for details on what values are provided to the template. The examples below are modeled after the Database engine’s data, however the specific fields that are provided from a given engine may differ from these examples

However, there is no reference in the snowflake docs or api docs to any data fields that the plugin may expose. The default username template in the plugin makes reference to DisplayName & RoleName.

Is there any docs page that explains the available data fields? Ideally I would expect a section on the database engine api docs for common data fields and then fields available per connector listed on the connector page.

I’m a little confused by your question. Are you asking what fields are available to use in setting up your name templating? If so see the link below – just note that not every secret engine supported templating. With each version of Vault more and more engines are add this feature but it isn’t 100% coverage at this time (latest being 1.10).

I agree, sadly the Vault docs are not always that good, especially concerning recently added features. It feels like the https://www.vaultproject.io/docs/concepts/username-templating page exists in some ways as a stop-gap short-term measure, partially compensating for the main Database plugin docs not having been updated.

Looking at the code, the snowflake plugin does not expose any additional data fields, so DisplayName & RoleName are all there is to use.

related to this (but for a different plugin), i was wondering whether it would be possible to do something like

username_template="v-{{ index (.DisplayName | string.Split \"-\") 1 }}-{{.RoleName}}"

(the above doesn’t work of course). specifically, i only want the username and not the access method in the username_template.