file functions references

docs/packer-seo-templates-batch2
trujillo-adam 1 year ago
parent 953c814ad5
commit 75678c5de2

@ -1,6 +1,6 @@
---
page_title: abspath - Functions - Configuration Language
description: The abspath function converts the argument to an absolute filesystem path.
page_title: abspath function reference
description: The `abspath` function converts an argument to an absolute filesystem path. Learn how to use the `abspath` function in Packer templates.
---
# `abspath` Function

@ -1,8 +1,7 @@
---
page_title: basename - Functions - Configuration Language
page_title: basename function reference
description: |-
The basename function removes all except the last portion from a filesystem
path.
The `basename` function removes parts of a filesystem path except for the last portion. Learn how to use the `basename` function in Packer templates.
---
# `basename` Function

@ -1,6 +1,6 @@
---
page_title: dirname - Functions - Configuration Language
description: The dirname function removes the last portion from a filesystem path.
page_title: dirname function reference
description: The `dirname` function removes the last portion from a filesystem path. Learn how to use the `dirname` function in Packer templates.
---
# `dirname` Function

@ -1,8 +1,7 @@
---
page_title: file - Functions - Configuration Language
page_title: file function reference
description: |-
The file function reads the contents of the file at the given path and
returns them as a string.
The `file` function reads the contents of a file and returns it as a string. Learn how to use the `file` function in Packer templates.
---
# `file` Function

@ -1,6 +1,6 @@
---
page_title: fileexists - Functions - Configuration Language
description: The fileexists function determines whether a file exists at a given path.
page_title: fileexists function reference
description: The `fileexists` function determines whether a file exists at a given path. Learn how to use the `fileexists` function in Packer templates.
---
# `fileexists` Function

@ -1,6 +1,6 @@
---
page_title: fileset - Functions - Configuration Language
description: The fileset function enumerates a set of regular file names given a pattern.
page_title: fileset function reference
description: The `fileset` function enumerates a set of regular file names according to a pattern. Learn how to use the `fileset` function in Packer templates.
---
# `fileset` Function

@ -1,8 +1,8 @@
---
page_title: pathexpand - Functions - Configuration Language
page_title: pathexpand function reference
description: |-
The pathexpand function expands a leading ~ character to the current user's
home directory.
The `pathexpand` function replaces a leading tilda `~` character with the current user's
home directory. Learn how to use the `pathexpand` function in Packer templates.
---
# `pathexpand` Function

@ -1,26 +1,22 @@
---
page_title: templatefile - Functions - Configuration Language
page_title: templatefile function reference
description: |-
The templatefile function reads the file at the given path and renders its
content as a template using a supplied set of template variables.
The `templatefile` function reads a file and renders its
content as a template using a set of template variables. Learn how to use the `templatefile` function.
---
# `templatefile` Function
-> _Recommendation:_ we recommend using the `.pkrtpl.hcl` file extension when
using the `templatefile` function. Template files _are_ hcl treated as files but
also templates and therefore have slightly different set of features
than the ones offered in a `.pkr.hcl` Packer template. While you are not
required to use this extension, doing so will enable syntax highlighters to
properly understand your file.
`templatefile` reads the file at the given path and renders its content as a
The `templatefile` function reads the file at the given path and renders its content as a
template using a supplied set of template variables.
```hcl
templatefile(path, vars)
```
We recommend using the `.pkrtpl.hcl` file extension when using the `templatefile` function to create templates. Packer treats HCL templates as combination of file and template. As a result, HCL template files have slightly different set of features than the templates with a `.pkr.hcl` extension. Using the `.pkr.hcl` extension also enables syntax highlighters to properly understand your file.
The template syntax is the same as for string templates in the main HCL2
language, including interpolation sequences delimited with `${ ... }`. This
function just allows longer template sequences to be factored out into a

Loading…
Cancel
Save