diff --git a/website/source/docs/templates/configuration-templates.html.markdown b/website/source/docs/templates/configuration-templates.html.markdown index d22e850df..2d4999a5b 100644 --- a/website/source/docs/templates/configuration-templates.html.markdown +++ b/website/source/docs/templates/configuration-templates.html.markdown @@ -4,34 +4,32 @@ layout: "docs" # Configuration Templates -Certain configuration parameters within templates are themselves a -type of "template." These are not Packer templates, but text templates, -where variables can be used to modify the value of a configuration parameter -during runtime. +All strings within templates are processed by a common Packer templating +engine, where variables and functions can be used to modify the value of +a configuration parameter at runtime. -For example, the `ami_name` configuration for the [AMI builder](/docs/builders/amazon-ebs.html) -is a template. An example value may be `My Packer AMI {{.CreateTime}}`. At -runtime, this will be turned into `My Packer AMI 1370900368`, where the -"CreateTime" variable was replaced with the Unix timestamp of when the -AMI was actually created. +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. -This sort of templating is pervasive throughout Packer. Instead of documenting -the templating syntax in each location, it is documented once here so -you know how to use it. +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}}`. -
.encoding = "UTF-8" @@ -47,3 +45,11 @@ resulting in a VMX that looks like this: displayName = "packer" guestOS = "otherlinux"+ +## Global Functions + +While some configuration settings have local variables specific to only that +configuration, a set of functions are available globally for use in _any string_ +in Packer templates. These are listed below for reference. + +* ``timestamp`` - The current Unix timestamp in UTC.