Search
⌃K

Random Values in Blueprints

In some cases, you might need to generate random strings in your Velocity Blueprint.
A common use case for using random strings is generating passwords, or secured tokens when provisioning new infrastructure resources.
Velocity allows you to use the {velocity.v1.generate:random}Velocity Template which will be resolved into a string upon provisioning. The syntax supports two options:
  1. 1.
    A simple random string that translates into an 8 character string: {velocity.v1.generate:random}
  2. 2.
    A custom regular expression: {velocity.v1.generate:random([a-zA-Z0-9]{8})}
The random generator uses a combination of environment name, environment creation date, resource identifier, and path in the manifest as a seed of the random generator

Random Values Example:

apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
annotations:
velocity.tech.v1/id: mysql
spec:
containers:
- name: mysql
env:
- name: DATABASE_NAME
value: 'orders'
- name: DATABASE_PASSWORD
value: '{velocity.v1.generate:random}'