Commit Graph

46 Commits

Author SHA1 Message Date
Wilken Rivera acabc1c1aa
Add packer fmt command (#10225)
* Add packer fmt command

This change adds a new command that allows users to format one or more
HCL2 Packer configuration template files.

Related to: #9174

* command/fmt: Add check flag

Packer's fmt command now supports a check flag that will output the name
of any file that would be changed by the HCL2 formatting engine. The
check flag is mutually exclusive with the write flag and will only check
if formatting is needed.

The update write flag will now overwrite the source files with the newly
formatted HCL2 source unless the `-write=false` or `-check` is passed at
the command line.

* Returns a diagnostic error if Format is unable to show a diff - equivalent to `terraform fmt`
* Updates testing to run against #Format and not the private methods of the HCL2Formatter; fixes ShowDiff test failure on Windows
* Updates comments for exported functions

* Add docs for fmt command
2020-11-11 11:49:39 -05:00
Adrien Delorme deba1484ff
HCL2: allow calling env as input var default value (#10240)
* HCL2: allow to use env in default value of input variables
2020-11-11 11:27:32 +01:00
packer-ci 40d60af00a cut version 1.6.5 2020-10-30 19:31:46 +00:00
Adrien Delorme 4bc16455b4
HCL2: add a packer block with a required_version input setting (#10149)
* add the possibility to set the packer.required_version field; to make sure the template file works with that version of Packer
* add tests
* add documentation on packer.required_version

Example:

packer {
  required_version = ">= 1.2.0, < 2.0.0"
}
2020-10-27 10:03:36 +01:00
Megan Marsh fc619dc977
Merge pull request #9626 from featheredtoast/add-proxmox-vm-clone
builder/proxmox FEATURE: split Proxmox into proxmox-iso and proxmox-clone
2020-10-23 13:36:45 -07:00
Adrien Delorme 6d4fae0f2d
Add HCL2 aws_secretsmanager function (#10124)
* refactor aws get secrets function out to reuse it else where
* add aws_secretsmanager func and docs for HCL2
* fix GetSecret: allow to pick secret version
2020-10-20 16:21:40 +02:00
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 f696e8286e contextual functions menu section for vault func 2020-10-16 14:27:16 -07:00
Adrien Delorme b2be255057 Merge remote-tracking branch 'origin/master' into pr/featheredtoast/9626-1 2020-10-06 11:11:04 +02:00
packer-ci e75da4c6e5 cut version 1.6.4 2020-09-30 17:54:03 +00:00
packer-ci 5daf04a280 cut version 1.6.3 2020-09-25 19:37:48 +00:00
Jeff Wong f0c76bad52 DOCS: update docs navigation 2020-09-14 12:22:18 -07:00
packer-ci 576e227e60 cut version 1.6.2 2020-08-28 15:06:26 +00:00
Wilken Rivera bd0cb85bb6 Reset change entries made by the packer-ci release bot
This reverts commit c35837ee49.
2020-08-28 10:55:55 -04:00
packer-ci 10f34a3b12 cut version 1.6.2 2020-08-27 20:58:07 +00: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
sylviamoss a447d151bb add community supported post-processor 2020-08-10 14:09:58 +02:00
packer-ci 214bef3697 cut version 1.6.1 2020-07-30 20:04:33 +00: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 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
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
Gennady Lipenkov 32b77f3b80 Update doc pages 2020-07-08 22:54:20 +03: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 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
Megan Marsh ca067475fd
add new doc about pipelineing (#9437) 2020-06-17 10:59:45 +02:00
Megan Marsh 1eb868cef5
Merge pull request #9384 from hashicorp/website/getting-started/migration
Refactored to learn hosted gettings started track.
2020-06-11 13:36:35 -07:00
packer-ci 05a2b854c4 cut version 1.6.0 2020-06-09 19:31:33 +00:00
DerekStrickland 6de0dce33a Refactored to redirects instead of hard external links in side nav model 2020-06-09 13:58:33 -04: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
DerekStrickland b8f9d2e988 Refactored to learn hosted gettings started track. 2020-06-08 15:53:00 -04: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
Jeremiah Snapp 3f2b8587b1 Replace regexreplace docs typo with regex_replace
Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
2020-06-05 13:17:18 -04:00
Jeremiah Snapp 3b9a0427cd Add template_dir function to HCL
Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
2020-06-05 13:14:36 -04:00
Jeremiah Snapp 2800043149 Add pwd function to HCL
Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
2020-06-05 13:14:03 -04:00
Adrien Delorme 72f76cbc8e document hcl2 blocks 2020-05-26 15:29:47 +02:00
Megan Marsh 6a682aca2e
Merge pull request #9124 from GennadySpb/yandex-export-post-processor
[WIP] Yandex export post processor
2020-05-05 11:01:13 -07:00
Megan Marsh 991511d08a cut release 1.5.6 2020-05-01 14:11:35 -07:00
Gennady Lipenkov 17a5b5db24 Add docs and nav reference 2020-04-27 02:21:13 +03:00
Jeff Escalante 23aba814e1
update to 1.5.5 2020-04-07 17:50:51 -04:00
Jeff Escalante db48bf7d58
adjust builder nesting paths 2020-04-07 17:50:49 -04:00
Jeff Escalante ace31df874
docs pages navigation 2020-04-07 17:50:49 -04:00
Jeff Escalante 02e297b034
guides section nav 2020-04-07 17:50:48 -04:00
Jeff Escalante a159d6f9b3
intro nav 2020-04-07 17:50:47 -04:00
Jeff Escalante 92d4553890
initial port 2020-04-07 17:50:46 -04:00
Matthew Hooker 0023aa11cf
add kms_key_id to block device docs 2018-01-12 14:48:18 -08:00