hcl2_upgrade transforms a JSON build-file in a HCL2 build-file. This starts a validated Packer core and from that core we generate an HCL 'block' per plugin/configuration. So for a builder, a provisioner, a post-processor or a variable. The contents of each block is just transformed as is and basically all fields are HCL2-ified. A generated field can be valid in JSON but invalid on HCL2; for example JSON templating (in mapstructure) allows to set arrays of strings - like `x = ["a", "b"]` - with single strings - like `x="a"` -, HCL does not allow this. Since JSON does not make the distinction between variables and locals, everything will be a variable. So variables that use other variables will not work. hcl2_upgrade tries to transform go templating interpolation calls to HCL2 calls when possible, leaving the go templating calls like they are in case it cannot. Work: * transpiler * tests * update hcl v2 library so that output looks great. * update docs
7 lines
436 B
Plaintext
7 lines
436 B
Plaintext
-> **Note:** This page is about HCL2 in Packer 1.5 and later. HCL2 support for
|
|
Packer is still in Beta. Please see the [Packer Issue
|
|
Tracker](https://github.com/hashicorp/packer/issues/9176) for a list of
|
|
supported features. For the old-style stable configuration language see
|
|
[template docs](/docs/templates). You can now transform your JSON file into an
|
|
HCL2 config file using the [hcl2_upgrade command](/docs/commands/hcl2_upgrade).
|