Templating
Templating uses variables and the OneFuse Template Engine to produce dynamic configuration values
2 minute read
To learn more, refer to the Templating guide and Property Toolkit features.
Example
When requesting a VM, the requester chooses a value for the Environment field. Using templating, you can use the variable Environment and apply further logic to create a dynamic result.
{# Environment variable has two options on the request: "Development" and "Production" #}
{# Requester selects "Development" for Request 1 #}
{# We will print the variable Environment below #}
{{ Environment }}
=> "Development"
{# Requester selects "Production" for Request 2 #}
{# We will print the variable Environment below #}
{{ Environment }}
=> "Production"
{# Requester selects "Production" for Request 3 #}
{# You can further manipulate the variable using Filters #}
{#
We will print the variable Environment below with the "first" and "lower" filters
- The "first" Filter will get the first letter of the variable
- The "lower" Filter will lowercase the result of the variable after the previous filter is applied
#}
{{ Environment | first | lower }}
=> "p"
Templating in policies
Policies allow for templating where it matters to achieve sophisticated use cases quickly without lines of custom code. When a policy is executed from an upstream provider, script or self-service API call, the user can pass in properties to drive the desired configuration output.
To learn more, refer to Property Sets for modeling OneFuse Policies.