diff --git a/content/docs/04.workflow-components/04.variables.md b/content/docs/04.workflow-components/04.variables.md index 6d6d23a37f..fbfe722dc5 100644 --- a/content/docs/04.workflow-components/04.variables.md +++ b/content/docs/04.workflow-components/04.variables.md @@ -41,6 +41,29 @@ Dynamic variables will be rendered thanks to the Pebble templating engine. Pebbl Since 0.14, Variables are no longer rendered recursively. You can read more about this change and how to change this behaviour [here](../11.migration-guide/0.14.0/recursive-rendering.md). :: +## Dynamic Variables + +If you want to have an expression inside of your variable, you will need to wrap it in `render` when you use it in a task. + +For example, this variable will only display the current time in the log message when wrapped in `render`. Otherwise, the log message will just contain the expression as a string: + +```yaml +id: dynamic_variable +namespace: company.team + +variables: + time: "{{ now() }}" + +tasks: + - id: log + type: io.kestra.plugin.core.log.Log + message: "{{ render(vars.time) }}" +``` + +::alert{type="info"} +You will need to wrap the variable expression in `render` every time you want to use it in a task. +:: + ## FAQ ### How do I escape a block in Pebble syntax to ensure that it won't be parsed?