Commit Graph

11 Commits

Author SHA1 Message Date
Adrien Delorme 5ba134ac5b
JSON to HCL2 (minimal best-effort) transpiler (#9659)
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
2020-08-25 10:51:43 +02:00
Adrien Delorme 7de6c21a8a
HCL: document contextual source variable usage (#9799)
It is possible to use ${source.name} and ${source.type}, this was not documented before
2020-08-21 13:37:08 +02:00
Jonathan Neal d8b67f8520
📌 Hard Pin Website Dependencies (#9543)
* Update and pin dependencies
* Update NextJS Scripts
* npm run lint
* npm run format
* docs generator: indent docs by two and make spacing better

Co-authored-by: Adrien Delorme <azr@users.noreply.github.com>
2020-07-13 12:33:16 +02:00
Adrien Delorme 451d4c2620
hcl2 docs pass (#9375)
* moved blocks and functions top the nav list for easier access ( I think those will be used a lot)
* added a concrete fileset example
* added more concrete examples in the blocks doc
2020-06-09 12:42:01 +02:00
Adrien Delorme 52ba74e3c9 better docs 2020-06-02 16:33:32 +02:00
Adrien Delorme 83b3eb3be2 better words on the hcl2 merge 2020-06-02 12:35:32 +02:00
Adrien Delorme e2b620677c Update example-block.mdx 2020-06-02 12:25:16 +02:00
Adrien Delorme b075ae47d7 Update assignment.mdx 2020-06-02 12:17:46 +02:00
Adrien Delorme 022ed5b29e Update assignment.mdx 2020-06-02 11:58:48 +02:00
Adrien Delorme 4349a55e61 Explain that input values can be used in locals from example locals block 2020-06-02 11:57:32 +02:00
Adrien Delorme 72f76cbc8e document hcl2 blocks 2020-05-26 15:29:47 +02:00