Packer legacy JSON template deprecation in CI
Packer deprecated the legacy JSON template format in favor of HCL2. Newer Packer prints a deprecation notice for .json templates and can fail if the JSON uses features no longer supported.
What this error means
packer build on a .json template prints a deprecation warning, or fails on a legacy field, recommending you migrate to HCL2 with packer hcl2_upgrade.
Warning: Deprecated: the JSON template format is deprecated.
Use HCL2 instead. To upgrade this template run: packer hcl2_upgrade template.jsonCommon causes
The pipeline still builds a JSON template
The .json format is deprecated, so newer Packer warns on every run and may reject removed fields.
A JSON-only feature has no HCL equivalent path
Some legacy constructs are unsupported in current Packer, causing a hard failure rather than a warning.
How to fix it
Upgrade the template to HCL2
- Run
packer hcl2_upgradeon the JSON template. - Review the generated
.pkr.hcland adjust variables and sources. - Point the CI build at the HCL2 template.
packer hcl2_upgrade template.json
packer validate template.pkr.hclPin an older Packer only as a stopgap
If you cannot migrate immediately, pin a Packer version that still accepts the JSON template, but plan the HCL2 move.
How to prevent it
- Migrate JSON templates to HCL2 with
packer hcl2_upgrade. - Run
packer validateon the HCL2 output in CI. - Track Packer release notes for removed legacy features.