hashicorp / hashicorp/packer

Packer tries to validate vars parameters that is comment out

Open
#13,370 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
15.8k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

#### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

#### Overview of the Issue

When I run `pucker build .` I get error `Invalid value for "vars" parameter: vars map does not contain key`. Packer shows that referenced line is in .pkrtpl.hcl file and that line is commented out.

#### Reproduction Steps

Create simple packer template using .pkrtpl.hcl template, and in a Identity block use wrong var name.
For example: `realname: ${wrong_var_name}`. Run `pucker build .`

### Packer version

Packer v1.12.0

### Operating system and Environment details

Windows 11 24H2

### Log Fragments and crash.log files

```
Call to function "templatefile" failed:
var.guest_password_encrypted as "REPLACED",
C:/Users/User/Documents/GitHub/boilerplates/packer/proxmox/ubuntu_24.04/data/user-data.pkrtpl.hcl:43,30-31:
var.guest_username as "REPLACED",
Extra characters after interpolation expression; Expected a closing brace to end
var.vm_guest_os_timezone as "REPLACED",
the interpolation expression, but found extra characters.
var.vm_name as "ubuntu-server-noble-numbat".

This can happen when you include interpolation syntax for another language, such

as shell scripting, but forget to escape the interpolation start token. If this
is an embedded sequence for another language, escape it by starting with "$${"
Call to function "templatefile" failed:
instead of just "${"..
C:/Users/User/Documents/GitHub/boilerplates/packer/proxmox/ubuntu_24.04/data/user-data.pkrtpl.hcl:43,30-31:

2025/05/02 02:54:39 [INFO] (telemetry) Finalizing.
Extra characters after interpolation expression; Expected a closing brace to end
the interpolation expression, but found extra characters.

This can happen when you include interpolation syntax for another language, such
as shell scripting, but forget to escape the interpolation start token. If this
is an embedded sequence for another language, escape it by starting with "$${"
instead of just "${"..
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.