Built-in Functions
Note: This page is about HCL2 Packer templates. HCL2 templates were first introduced as a beta feature into Packer version 1.5. As of v1.7, HCL2 support is no longer in beta, and is the preferred way to write Packer configuration. For the old-style stable configuration language see template docs. As of v1.6.2, you can convert your legacy JSON template into an HCL2 config file using the hcl2_upgrade command.
The HCL language includes a number of built-in functions that you can call from within expressions to transform and combine values. The general syntax for function calls is a function name followed by comma-separated arguments in parentheses:
For information on invoking functions in string literals, refer to the String Literals section in the HCL2 expressions documentation.
The HCL language does not support user-defined functions, and so only the functions built in to the language are available for use. The documentation includes all of the available built-in functions.