Path variables
Note: If possible, try to always use a forward slash /
as the path separator,
especially when dealing with relative paths. A backward slash \
will work on
Windows and is the official Windows path separator, but when building from any
system that is not Windows, Packer will only treat slashes /
as path
separators, and treat backslashes as plain text. Which could lead to pathing
errors.
path.cwd
: the directory from where Packer was started.path.root
: the directory of the input HCL file or the input folder.
Examples
Related Functions
abspath
takes a string containing a filesystem path and converts it to an absolute path.basename
returns only the last portion of a filesystem path, discarding the portion that would be returned bydirname
.fileset
enumerates a set of regular file names given a path and pattern.dirname
returns all of the segments of a filesystem path except the last, discarding the portion that would be returned bybasename
.