diff --git a/website/content/docs/templates/hcl_templates/functions/file/abspath.mdx b/website/content/docs/templates/hcl_templates/functions/file/abspath.mdx index b9c28ca97..87c8074c4 100644 --- a/website/content/docs/templates/hcl_templates/functions/file/abspath.mdx +++ b/website/content/docs/templates/hcl_templates/functions/file/abspath.mdx @@ -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 diff --git a/website/content/docs/templates/hcl_templates/functions/file/basename.mdx b/website/content/docs/templates/hcl_templates/functions/file/basename.mdx index 70a05e08a..4ed4df133 100644 --- a/website/content/docs/templates/hcl_templates/functions/file/basename.mdx +++ b/website/content/docs/templates/hcl_templates/functions/file/basename.mdx @@ -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 diff --git a/website/content/docs/templates/hcl_templates/functions/file/dirname.mdx b/website/content/docs/templates/hcl_templates/functions/file/dirname.mdx index 348c0363a..b76b056ba 100644 --- a/website/content/docs/templates/hcl_templates/functions/file/dirname.mdx +++ b/website/content/docs/templates/hcl_templates/functions/file/dirname.mdx @@ -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 diff --git a/website/content/docs/templates/hcl_templates/functions/file/file.mdx b/website/content/docs/templates/hcl_templates/functions/file/file.mdx index 6dd36ee3a..873ecd8a4 100644 --- a/website/content/docs/templates/hcl_templates/functions/file/file.mdx +++ b/website/content/docs/templates/hcl_templates/functions/file/file.mdx @@ -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 diff --git a/website/content/docs/templates/hcl_templates/functions/file/fileexists.mdx b/website/content/docs/templates/hcl_templates/functions/file/fileexists.mdx index b8b0b3fe2..6d4f302d3 100644 --- a/website/content/docs/templates/hcl_templates/functions/file/fileexists.mdx +++ b/website/content/docs/templates/hcl_templates/functions/file/fileexists.mdx @@ -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 diff --git a/website/content/docs/templates/hcl_templates/functions/file/fileset.mdx b/website/content/docs/templates/hcl_templates/functions/file/fileset.mdx index e60dd126d..da6d44ece 100644 --- a/website/content/docs/templates/hcl_templates/functions/file/fileset.mdx +++ b/website/content/docs/templates/hcl_templates/functions/file/fileset.mdx @@ -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 diff --git a/website/content/docs/templates/hcl_templates/functions/file/pathexpand.mdx b/website/content/docs/templates/hcl_templates/functions/file/pathexpand.mdx index 974716c8f..849497a4e 100644 --- a/website/content/docs/templates/hcl_templates/functions/file/pathexpand.mdx +++ b/website/content/docs/templates/hcl_templates/functions/file/pathexpand.mdx @@ -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 diff --git a/website/content/docs/templates/hcl_templates/functions/file/templatefile.mdx b/website/content/docs/templates/hcl_templates/functions/file/templatefile.mdx index 68cc8cf47..27538733d 100644 --- a/website/content/docs/templates/hcl_templates/functions/file/templatefile.mdx +++ b/website/content/docs/templates/hcl_templates/functions/file/templatefile.mdx @@ -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