Closed deric4 closed 4 years ago
Hey @deric4, sorry to hear you had that bug; it was fixed on master and the latest nightly binaries should work with your case. Can you please tell us if that's the case ? Thanks !
Thanks @azr for the quick follow up! I searched recent issues and missed that one: I no longer see the panic š . Should it still be an error to not define a default in required.pkr.hcl
while setting it in myvars.pkrvars.hcl
though?
#myvars.pkrvars.hcl
ami_name = "mycoolami"
#required.pkr.hcl
variable "ami_name" {
description = "the name of the ami"
}
It works when I convert my myvars.pkrvars.hcl
to the auto format: myvars.auto.pkrvars.hcl
edit: basically trying to understand/implement what you guys were discussing regarding -var-file
here https://github.com/hashicorp/packer/pull/8882#issuecomment-598656653
Hey @deric4 sure š ! Nice that you don't see the panic š . I'll keep that issue around in case someone has it again. We'll close it when we release.
Packer will only 'auto detect' var files ending with .auto.pkrvars.hcl
or .auto.pkrvars.json
, if you want to use myvars.pkrvars.hcl
you have to pass it from the -var-file
option.
Okay, closing this issue as it was fixed in 1.5.5 !
I'm going to lock this issue because it has been closed for 30 days ā³. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Overview of the Issue
Was kicking the tires on the hcl2 support so not sure if this actually a bug, but it seems that defining variables w/o a default value in required.pkr.hcl and setting the value in a separate file i.e. myvars.pkrvars causes
packer build
to crashReproduction Steps
Steps to reproduce this issue
packer build .
Packer version
From
packer version
Simplified Packer Buildfile
If the file is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.
Operating system and Environment details
OS, Architecture, and any other information you can provide about the environment.
Log Fragments and crash.log files
Include appropriate log fragments. If the log is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.
Set the env var
PACKER_LOG=1
for maximum log detail.Logs:
https://gist.github.com/deric4/2816ef87ccc67a2aa2fdb8553a5dcd11
Some Other Observations
when I set a default value in required.pkr.hcl, it just gave a normal error. Based on #8882 , I thought this would work but not a big deal...
https://gist.github.com/deric4/2816ef87ccc67a2aa2fdb8553a5dcd11#file-error_with_empty_default-log
It does work however if I rename
myvars.pkvars -> myvars.auto.pkvars
(with the default set in required.pkr.hcl)