Packer JSON -> HCL Conversion - What to do with Varibles?

I’m preparing to convert our packer automations from JSON-> HCL. Yes I understand I’m a bit behind the times. When I try to input a variable file (which is still in JSON format) none of the commands work.

Example: packer validate -var-file=packer-vars.json packer-build-.pkr.hcl

It acts like I used --help and doesn’t try to validate the file. Can JSON based variables only be used with JSON formatted templates? Do I need to just make them all locals?

Hi, i can’t test it right now, but you should try to upgrade your var file to hcl2 using this method Upgrade Packer JSON Template to HCL2 | Packer | HashiCorp Developer

If it works, then you can try to re-launch your packer validate command :slight_smile: