From f73617b6b70faa6c33c3f762e66672ad65204098 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Mon, 15 May 2017 14:31:58 -0400 Subject: [PATCH] Made some changes to the Packer templating docs 1. Added the `user` function. 2. Some tidying up of language. --- website/source/docs/templates/engine.html.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/website/source/docs/templates/engine.html.md b/website/source/docs/templates/engine.html.md index 6c5eecc1e..788e56584 100644 --- a/website/source/docs/templates/engine.html.md +++ b/website/source/docs/templates/engine.html.md @@ -18,13 +18,12 @@ For example, the `{{timestamp}}` function can be used in any string to generate the current timestamp. This is useful for configurations that require unique keys, such as AMI names. By setting the AMI name to something like `My Packer AMI {{timestamp}}`, the AMI name will be unique down to the second. -If you need greater than one second granularity, you should use `{{uuid}}`, as -when you have multiple builders in the same template. +If you need greater than one second granularity, you should use `{{uuid}}`, for example when you have multiple builders in the same template. -In addition to globally available functions like timestamp shown before, some -configurations have special local variables that are available only for that -configuration. These are recognizable because they're prefixed by a period, such -as `{{.Name}}`. +In addition to globally available functions like `{{timestamp}}`, some +configurations have special local variables that are available only for +that configuration. These are recognizable because they're prefixed by a +period, such as `{{.Name}}`. The complete syntax is covered in the next section, followed by a reference of globally available functions. @@ -33,9 +32,9 @@ globally available functions. The syntax of templates uses the following conventions: -* Anything template related happens within double-braces: `{{ }}` -* Variables are prefixed with a period and capitalized, such as `{{.Variable}}` -* Functions are directly within the braces, such as `{{timestamp}}` +* Anything template related happens within double-braces: `{{ }}`. +* Variables are prefixed with a period and capitalized, such as `{{.Variable}}`. +* Functions are directly within the braces, such as `{{timestamp}}`. Here is an example from the VMware VMX template that shows configuration templates in action: @@ -72,6 +71,7 @@ in Packer templates. These are listed below for reference. - `timestamp` - The current Unix timestamp in UTC. - `uuid` - Returns a random UUID. - `upper` - Uppercases the string. +- `user` - Specify a user variable. ### isotime Format