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
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
Useif, else if, else, and end:
Comparison operators
eq- equal tone- not equal tolt- less thanle- less than or equal togt- greater thange- greater than or equal to
Boolean logic
Useand, 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 theserviceInstallation function:
Using blueprint outputs
Reference outputs exposed by blueprints installed in the same environment using theblueprintInstallation function. Blueprint outputs are declared in the blueprint spec and resolved from underlying installation outputs.