I get this error when running ‘packer build’:
$ packer build .
Error: Call to unknown function
on externalities.pkr.hcl line 13, in variable "stuff_dir":
13: default = pathexpand("~/stuff")
There is no function named "pathexpand".
But:
$ packer console --config-type=hcl2
> pathexpand("~/stuff")
> /Users/me/stuff
This is my variable definition:
variable "stuff_dir" {
type = string
default = pathexpand("~/stuff")
}
Am I going crazy? If the function doesn’t exist, how come I can call it from the console? Can I only call it in limited circumstances and is the error message wrong?