Packer: min_packer_version JSON key not supported as argument in HCL syntax

Created on 22 May 2020  ·  4Comments  ·  Source: hashicorp/packer

Overview of the Issue

The min_packer_version key could specify the minimum Packer version for a template in JSON. This does not seem to be currently supported in HCL syntax. Since this seems more like functional metadata, I am not sure where eventually it should ideally be specified.

Reproduction Steps

packer build

Packer version

1.5.6

Simplified Packer Buildfile

source "source" "name" {
  min_packer_version = "1.5.6"
}

or

build {
  min_packer_version = "1.5.6"
}

Operating system and Environment details

Ubuntu 18.04

Log Fragments and crash.log files

Error: Unsupported argument
...
An argument named "min_packer_version" is not expected here.

bug hcl2 track-internal

Most helpful comment

Update here, I think this should be in a packer block:

packer {
  required_version = ">= 1.2.0, < 2.0.0" // < some selector
}

All 4 comments

Hey @mschuchard ! Thanks for opening ! I'll make sure to add this to the TODO 🙂. After some thinking I'm thinking of allowing to set this per hcl file at the top-level, for example:

min_packer_version = "1.5.6"
build {
  # ....
}

We would simply check this value if it's set and error/not read the file in case.

Update here, I think this should be in a packer block:

packer {
  required_version = ">= 1.2.0, < 2.0.0" // < some selector
}

Thank you for expanding upon the original ask, and including the semantic version operator ~> in the expansion.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shashanksinha89 picture shashanksinha89  ·  3Comments

s4mur4i picture s4mur4i  ·  3Comments

wduncanfraser picture wduncanfraser  ·  3Comments

jesse-c picture jesse-c  ·  3Comments

mushon4 picture mushon4  ·  3Comments