mirror of
https://github.com/hashicorp/packer.git
synced 2026-06-13 18:50:11 -04:00
Currently the HCL2 upgrade command generates a valid variable block for all variables within the JSON variables property. However JSON templates in Packer support variable interpolation for input variables defined within a variable definition file without it being declared within the variables property. When upgrading a JSON template to HCL2 the user variable reference gets converted to var.<var_name>. The upgraded template ultimately fails on validation or build execution with undefined variable errors, with this change the upgrade command will now create a variable block for all input variables referenced within the build template to ensure all required variables been defined.
18 lines
302 B
JSON
18 lines
302 B
JSON
{
|
|
"variables": {
|
|
"foo": "bar"
|
|
},
|
|
"builders": [
|
|
{
|
|
"type": "null",
|
|
"communicator": "{{ user `communicator_type` }}"
|
|
}
|
|
],
|
|
"provisioners": [
|
|
{
|
|
"type": "shell",
|
|
"script": "{{user `scriptpath`}}"
|
|
}
|
|
]
|
|
}
|
|
|