Skip to main content
Template functions enable dynamic configuration across all installation types. These generic functions work in both blueprint configurations and installation configs.

Template context object

All templates have access to the .ryvn context object. The following properties are available:

.ryvn.env — environment context

For the full list of .ryvn.env.state properties (VPC IDs, subnet CIDRs, cluster endpoints, domain names, etc.), see the Outputs section of the environment reference for your provider: AWS, GCP, Azure.

.ryvn.installation — installation context

.ryvn.release — release context

.ryvn.registrySecrets — registry credentials

Template helper functions

k8sSecretValue copies the secret value into the rendered config and can leak sensitive data, so use it only for Terraform installations, which cannot take a secret reference. Everywhere else, use k8sSecretName.

String functions

lower, upper, title, trim

Transform string values.

contains

Check if a string contains a substring. Returns boolean.

substring

Extract a substring from a string. If start is < 0, extracts from beginning to end position. If end is < 0 or greater than length, extracts from start to end of string.

shortHash

Derive a fixed 16-character, lowercase identifier (a-z, 2-7) from any string: the first 10 bytes of the SHA-256 of the exact input, base32-encoded without padding. The same input always gives the same output; the empty string is accepted. Useful when a long or unpredictable value has to fit a length-limited name.

default

Provide a default value if the given value is empty or undefined.

Data formatting functions

toYaml

Convert data structures to YAML format. Useful for including complex configuration objects.

toJson

Convert data structures to JSON format.

indent, nindent

Add indentation to multi-line strings. indent adds spaces to each line. nindent adds a newline before indenting.

join

Join array elements with a separator.

omit

Copy a map without the given keys.

Control flow

Go templates support control flow statements for conditional logic.

Conditionals

Use if, else if, else, and end:

Comparison operators

  • eq - equal to
  • ne - not equal to
  • lt - less than
  • le - less than or equal to
  • gt - greater than
  • ge - greater than or equal to

Boolean logic

Use and, or, and not:

Examples

Provider-specific configuration

Configure differently based on cloud provider:

Using installation outputs

Reference outputs from other installations in the same environment using the serviceInstallation function:

Using blueprint outputs

Reference outputs exposed by blueprints installed in the same environment using the blueprintInstallation function. Blueprint outputs are declared in the blueprint spec and resolved from underlying installation outputs.
Secret outputs (isSecret: true in the blueprint output definition) are not available via .outputs template syntax. Use valueFromOutput in env vars to consume them (see Server or Job reference). For Helm charts, use .outputsSecret to get the Kubernetes secret name and reference individual keys:

Complex data transformation

Combine multiple functions:

Using release images

Reference images from releases:

Environment-specific scaling

Configure resources based on environment: