docs/snippets/documentation/platform/dynamic-secrets/dynamic-secret-username-template-field.mdx
Specifies a template for generating usernames. This field allows customization of how usernames are automatically created.
Allowed template variables are:
- `{{randomUsername}}`: Random username string.
- `{{unixTimestamp}}`: Current Unix timestamp at the time of lease creation.
- `{{identity.name}}`: Name of the identity that is generating the lease.
- `{{dynamicSecret.name}}`: Name of the associated dynamic secret.
- `{{dynamicSecret.type}}`: Type of the associated dynamic secret.
- `{{random N}}`: Random string of N characters.
Allowed template functions are:
- `truncate`: Truncates a string to a specified length.
- `replace`: Replaces a substring with another value.
- `uppercase`: Converts a string to uppercase.
- `lowercase`: Converts a string to lowercase.
Examples:
```yaml
{{ randomUsername }} // 3POnzeFyK9gW2nioK0q2gMjr6CZqsRiX
{{ unixTimestamp }} // 17490641580
{{ identity.name }} // <identity-name>
{{ random 5 }} // x9K2m
{{ truncate identity.name 4 }} // test
{{ replace identity.name '<identity-name>' 'new-value' }} // new-value
```