Megan Marsh
cc7dbf6092
Add consul_key function to integrate concul with hcl2 tempaltes. ( #10119 )
...
* Add consul_key function to integrate concul with hcl2 tempaltes.
* sidebar nav
2020-10-19 14:07:13 +02:00
Megan Marsh
a8ee23a9f9
Merge pull request #10117 from hashicorp/packer_version_func_hcl
...
implement packer_version func in hcl
2020-10-16 14:38:39 -07:00
Megan Marsh
09c6d2880f
implement packer_version variable in hcl
2020-10-16 14:07:05 -07:00
Megan Marsh
66b81d9bee
add build.name to hcl code ( #10114 )
2020-10-16 10:57:42 +02:00
Adrien Delorme
4cb218749b
remove unecessary check
2020-10-05 15:34:35 +02:00
Adrien Delorme
ebb1cb406c
ignore walk error
2020-10-02 10:53:17 +02:00
Adrien Delorme
bb22cfcf34
HCL2: pass sensitive variables to packer.LogSecretFilter
...
Co-Authored-By: Megan Marsh <1008838+SwampDragons@users.noreply.github.com>
2020-10-02 10:17:07 +02:00
Adrien Delorme
180dc4a54e
add test
2020-09-30 12:02:52 +02:00
Adrien Delorme
f3e65b5eb1
use "github.com/hashicorp/go-cty-funcs/collection".CoalesceFunc
...
fix #9419
after https://github.com/hashicorp/go-cty-funcs/pull/5 was merged
2020-09-30 11:59:36 +02:00
Adrien Delorme
a70164f489
HCL2: when the type of a variable is not known evaluate setting as a litteral. ( #9863 )
...
* tests
* docs
2020-09-02 16:26:50 +02:00
Adrien Delorme
bdf198594e
hcl2 inspect: sort variables to have a consistent output
2020-09-01 15:28:16 +02:00
Adrien Delorme
eb4069a1b7
hcl variables: return an unknown value in when no default is set
2020-09-01 11:59:07 +02:00
Adrien Delorme
91c5a4613c
HCL2 inspect remove debug values
2020-09-01 11:59:07 +02:00
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
Megan Marsh
d486459a00
Merge pull request #9764 from hashicorp/hcl2_provisioner_override
...
Add override provisioner's option for HCL2
2020-08-14 09:49:34 -07:00
sylviamoss
62c3743890
implemet override provisioner's option for hcl2
2020-08-13 19:27:04 +02:00
jsmcnair
78c280b1b7
Use common funcs / fix panic / clarify docs
2020-08-12 22:34:13 +01:00
jsmcnair
33e3f62ff7
Add vault function for HCL2 and document
2020-08-11 09:18:15 +01:00
Sylvia Moss
9181a435aa
Make max_retries a string to allow variable interpolation ( #9673 )
2020-08-05 17:41:20 +02:00
Megan Marsh
2bd2954412
fix cty bool passing for provisioners, too
2020-07-30 11:25:44 -07:00
Megan Marsh
713e7a2683
fix docker-import postprocessor.
2020-07-29 14:59:50 -07:00
Adrien Delorme
c7b35dd6bc
HCL2: add post-processors block to run multiple post-processor after a build ( #9638 )
...
added `post-processors` block to run chained post-processors after a build.
Before this, defining multiple `post-processor` blocks after
provisioning steps would run them sequentially, now doing this makes them start
from the build's artifact. To queue post-processors you now have to define them
in a `post-processors` block.
This is a breaking change.
2020-07-28 10:02:37 +02:00
Adrien Delorme
44616d3bff
refactor initialization out from packer configs + tests ( #9627 )
...
The initialization of packer core in JSON also validates that `null` variables were set, except in the case of `packer validate --syntax-only` , but after the refactor to allow to have all commands work with HCL2 and JSON this subtlety was lost.
This refactors the initialisation of the core in order to allow to have `packer validate --syntax-only` not error in case a variable is not set. Since these calls are refactored this works for HCL2 too.
fix #9478
2020-07-24 10:58:03 +02:00
Adrien Delorme
125178d943
core: Decode: when in HCL2 decoding mode; reset the whole struct before preparing it. ( #9622 )
...
* core: Decode when in HCL2 decoding mode; reset the whole struct before preparing it.
* HCL2: add path variables + docs & tests
Co-authored-by: Megan Marsh <megan@hashicorp.com>
2020-07-23 09:25:07 +02:00
Adrien Delorme
f3fa8cd617
post-processor/provisioner: handle uint64 buildvars
2020-07-15 18:22:24 +02:00
Sylvia Moss
9c1409dbba
Add content_library_destination to import VM template to a Content Library ( #9551 )
2020-07-10 11:01:10 +02:00
Adrien Delorme
03d29386dd
fix error message typo ( #9541 )
2020-07-07 16:50:15 +02:00
Adrien Delorme
34ff3d0c8f
hcl2 GetBuilds: use packer.BuilderDataCommonKeys to avoid forcing all builders to return exactly what they will return
...
It would have been a bit nicer if all builder were more specific in order for hcl to tell wether a value will be set during the first prepare time but that also totally works !
2020-07-07 11:29:27 +02:00
Adrien Delorme
0293f69fa1
default build values to be unknown
2020-07-06 16:07:46 +02:00
Adrien Delorme
eaf63e3bb5
pass source name from local source name too
2020-07-06 16:07:29 +02:00
Adrien Delorme
cf514d31f2
avoid passing generatedVars down during first prepare
2020-07-06 15:14:17 +02:00
Adrien Delorme
0ed10f921f
add test
2020-07-06 11:48:39 +02:00
Adrien Delorme
90610dcf04
docs
2020-07-06 11:38:12 +02:00
Adrien Delorme
39261f3671
add hcl2 post processor type that reprepares itself
2020-07-06 10:32:39 +02:00
Adrien Delorme
db6c3adbba
add hcl2 provisioner type that reprepares itself
2020-07-02 18:02:19 +02:00
Adrien Delorme
284d46a1e0
WIP
2020-07-02 15:56:49 +02:00
Adrien Delorme
7969b690de
Revert "Share build info with Provisioner and Post-Processor via HCL2 variables ( #9444 )"
...
This reverts commit 99046c9178
.
2020-07-02 15:07:29 +02:00
Adrien Delorme
3d371a2d5d
Add complete HCL2 examples + allow to name a singular build.source blocks ( #9490 )
...
* in the examples/hcl folder
* add possibility to name singular build.source blocks to differentiate their output and to filter on them
2020-07-02 11:07:59 +02:00
Sylvia Moss
99046c9178
Share build info with Provisioner and Post-Processor via HCL2 variables ( #9444 )
2020-06-29 13:44:57 +02:00
Adrien Delorme
c2975140cf
HCL2: allow to use keep_input_artifact in post processors ( #9477 )
...
* HCL2: allow to use keep_input_artifact in post processors
* add basic test
* add docs
2020-06-25 09:36:48 +02:00
Adrien Delorme
6f4d79799b
add thorough test
2020-06-23 15:40:54 +02:00
Adrien Delorme
51d02f8c2d
hcl2: inspect command
2020-06-23 11:58:57 +02:00
Adrien Delorme
a96a8f22b9
HCL2: allow to describe a build block
2020-06-23 11:58:34 +02:00
Adrien Delorme
fb337f8867
hcl work on only/except ( #9454 )
...
* HCL2: allow to skip a named build block too
* test that excepting a build block works
* test only on a named build block
* add/update docs
2020-06-23 10:53:16 +02:00
Moss
daaeccd8b0
Skip consecutives post-processors
2020-06-09 17:35:53 +02:00
Moss
6599e7ab05
apply goimports
2020-06-09 15:29:32 +02:00
Moss
bfb9df0039
fix except flag for JSON and HCL2
2020-06-09 15:26:45 +02:00
Adrien Delorme
cf6eca7e1c
Revert "Add pwd function to HCL"
...
This reverts commit 2800043149
.
2020-06-08 14:59:27 +02:00
Adrien Delorme
44dfa221de
Revert "Add template_dir function to HCL"
...
This reverts commit 3b9a0427cd
.
2020-06-08 14:59:22 +02:00
Megan Marsh
d73f83a9d9
Merge pull request #9367 from jeremiahsnapp/add-template_dir-and-pwd-functions
...
Add template_dir() and pwd() functions to HCL
2020-06-05 12:57:04 -07:00