Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 1.21 KB

path-variables.mdx

File metadata and controls

40 lines (29 loc) · 1.21 KB
page_title description
Path Variables - HCL Configuration Language
Special variables provide directory information. This page covers all path variables.

@include 'path/separator-note.mdx'

Path variables

  • path.cwd: the directory from where Packer was started.

  • path.root: the directory of the input HCL file or the input folder.

Examples

locals {
  settings_file  = "${path.cwd}/settings.txt"
  scripts_folder = "${path.root}/scripts"
  root           = path.root
}

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 by dirname.

  • 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 by basename.