Commit Graph

13351 Commits

Author SHA1 Message Date
Adrien Delorme 1158eeb46d Update Makefile
to @go install ./cmd/mapstructure-to-hcl2 so that we can `make generate` and tests that generated code is what it should be
2019-10-15 12:56:43 +02:00
Adrien Delorme a8b2918d0e remote duplicate gob.Register(new(map[string]interface{}))
otherwise this panics
2019-10-15 12:56:42 +02:00
Adrien Delorme 8b1fcbb3bd vendor vendors 2019-10-15 12:56:42 +02:00
Adrien Delorme 2b0e0d4eab add hcl2template pkg
Package hcl2template defines code to parse hcl2 template files correctly.

In order to configure a packer builder,provisioner,communicator and post
processor.

Checkout the files in testdata/complete/ to see what a packer config could
look like.
2019-10-15 12:56:42 +02:00
Adrien Delorme 078ba7c8c3 commit old code generation tool
for history
2019-10-15 12:56:42 +02:00
Adrien Delorme 0eb9090dcf Create mapstructure-to-hcl2.go
mapstructure-to-hcl2 fills the gaps between hcl2 and mapstructure for Packer

By generating a struct that the HCL2 ecosystem understands making use of
mapstructure tags.

Packer heavily uses the mapstructure decoding library to load/parse user
config files. Packer now needs to move to HCL2.

Here are a few differences/gaps betweens hcl2 and mapstructure:

 * in HCL2 all basic struct fields (string/int/struct) that are not pointers
  are required ( must be set ). In mapstructure everything is optional.

 * mapstructure allows to 'squash' fields
 (ex: Field CommonStructType `mapstructure:",squash"`) this allows to
 decorate structs and reuse configuration code. HCL2 parsing libs don't have
 anything similar.

mapstructure-to-hcl2 will parse Packer's config files and generate the HCL2
compliant code that will allow to not change any of the current builders in
order to move to HCL2 to softly move to HCL2.
2019-10-15 12:56:42 +02:00
Adrien Delorme 438f704333 fmt 2019-10-15 12:56:42 +02:00
Adrien Delorme 193d3e6bbd provisioner.windows-shell: demove duplicate ExecuteCommand field 2019-10-15 12:56:42 +02:00
Adrien Delorme 771a6e55ef pp.google.[import|export]: unexport Account field
so it doesnt temper with hcl2 cfg generation
2019-10-15 12:56:42 +02:00
Adrien Delorme af08e2a410 pp.alicloud-import: remove duplicate AlicloudImageName field
( already defined in packerecs.Config )
2019-10-15 12:56:42 +02:00
Adrien Delorme 7be94f41a6 common.shell-local: unexport Ctx field
so that it doesn't temper with hcl2 generation
2019-10-15 12:56:42 +02:00
Adrien Delorme 766e5c77ef builder.vmware.vmx: remove duplicate RemoteType field. 2019-10-15 12:56:42 +02:00
Adrien Delorme 00e3f97f5b builder.vmware.iso: remove duplicate Format field 2019-10-15 12:56:42 +02:00
Adrien Delorme 6fbd664b66 builder.vagrant: simplify communicator.Config field 2019-10-15 12:56:42 +02:00
Adrien Delorme 3fe1c96491 builder.proxmox: make ProxmoxURL *url.URL field unexported
the only exported field we/users care about is ProxmoxURLRaw
2019-10-15 12:56:42 +02:00
Adrien Delorme 40692a4e38 builder.profitbricks: remove duplicate communicator.Config field 2019-10-15 12:56:41 +02:00
Adrien Delorme 3fa614b5e1 builder.oracle.oci: make ConfigProvider unexported
so that it doesn't temper with hcl2 code generation & parsing.

The field is set only later on after further processing.
2019-10-15 12:56:41 +02:00
Adrien Delorme 17c069baa5 builder.google:
* make CustomerEncryptionKey our own type so that it can be hcl2 generated
* make Account setting unexported so that it doesn't temper with HCL2 generation ( the field is set a bit later after processing )
2019-10-15 12:56:41 +02:00
Adrien Delorme f8402f1b91 builder.azure.common: make CloudEnvironment private so it doesn't temper with hcl2 code generation
the struct is not read from file but later set after some computations
2019-10-15 12:56:41 +02:00
Adrien Delorme 221e72e9c3 builder.amazon.common: remove pointer (*) from []*string and map[*string]*string types
because they make hcl2/cty decoding panic
2019-10-15 12:56:41 +02:00
Adrien Delorme 8b8c2fc138 builder.amazon.chroot: remove specific BlockDevice definition
because the common one already has a KmsKeyId field
2019-10-15 12:56:41 +02:00
Adrien Delorme 6a85855c81
Merge pull request #8230 from alrs/fix-provisioner-err
provisioner/shell: fix dropped error
2019-10-15 12:37:51 +02:00
Lars Lehtonen 9c19cfdc6f
provisioner/shell: fix dropped error 2019-10-15 03:21:05 -07:00
Adrien Delorme d2f5daf98f
Merge pull request #8209 from dvrkps/patch-3
Ignore retry.Config var
2019-10-15 10:29:51 +02:00
Megan Marsh f05fd3969f
Merge pull request #8212 from hashicorp/fix_8204
Fix 8204
2019-10-14 14:40:17 -07:00
Megan Marsh 2e20facc8b fix tests 2019-10-14 14:13:21 -07:00
Megan Marsh f5a0810e7a update changelog 2019-10-14 13:50:09 -07:00
Megan Marsh 7f6c8b93f8
Merge pull request #8227 from hashicorp/revert_backwards_incompatable_changes_for_1_4_5
Revert backwards incompatable changes for 1 4 5
2019-10-14 13:45:36 -07:00
Megan Marsh 0e70e0e5a4 fix template imports 2019-10-14 13:22:06 -07:00
Megan Marsh 9c782f4d04 Revert "Qemu builder disk size as a string"
This reverts commit 1ecfa032ba.
2019-10-14 13:09:22 -07:00
Megan Marsh 44f91c9afc Revert "remove clean_ami_name and clean_image_name; complete the deprecation for these functions in favor of clean_resource_name"
This reverts commit 0026792d2f.
2019-10-14 13:08:15 -07:00
Megan Marsh a45c7cfc3d
Merge pull request #8223 from lsmith130/patch-1
Update user-variables.html.md
2019-10-14 10:54:36 -07:00
Megan Marsh 985c49502e
Merge pull request #8224 from tencentyun/master
change links to english version
2019-10-14 10:42:44 -07:00
Landon Smith 4ea3460617
Update user-variables.html.md
Looks like the vault variables description was copied from the environment variables section, and someone left a reference to a environment variables.
2019-10-13 16:32:47 -07:00
Megan Marsh 90573a97dd
Merge pull request #8208 from psinghal20/conventional-format-isotime
feat: add strftime function in templates
2019-10-11 12:50:40 -07:00
Megan Marsh 2150ce7cba ran go mod vendor 2019-10-11 12:15:37 -07:00
Megan Marsh 95e1a0ef72 ran make generate to unstick tests 2019-10-11 12:05:46 -07:00
Megan Marsh a8da135a06
Merge pull request #8219 from EtienneDeneuve/master
Update docs for Sysprep
2019-10-11 09:53:08 -07:00
Etienne Deneuve f9aebe1c9c Change: Update doc, windows vm need ``/mode:vm`` to be syspreped correctly 2019-10-11 14:52:59 +02:00
Etienne Deneuve e574e9c4f6
Merge pull request #1 from hashicorp/master
Update packer repo
2019-10-11 14:34:54 +02:00
psinghal20 7f1f77b8c6
chore: tidy up go.mod
Signed-off-by: psinghal20 <psinghal20@gmail.com>
2019-10-11 14:35:44 +05:30
psinghal20 6492995a20
feat: add strftime function in templates
This commit adds strfttime function in templates to provide conventional format for ISO time based on C standard.

Signed-off-by: psinghal20 <psinghal20@gmail.com>
2019-10-11 14:35:39 +05:30
Davor Kapsa 29a6938de6
clean and return nil for retry.Config 2019-10-10 20:48:26 +02:00
Davor Kapsa 4c615341ef
Ignore retry.Config var
retry.Config is struct.
Call it err is wrong.
2019-10-10 17:33:24 +02:00
Adrien Delorme 9aac2246f2
Merge pull request #8210 from dvrkps/patch-4
Consolidate receiver name
2019-10-10 16:40:53 +02:00
Adrien Delorme 26ab75ea34
Merge pull request #8213 from chrisroberts/f-winrm-busy-loop
Prevent busy loop while waiting for WinRM connection
2019-10-10 14:49:27 +02:00
Li Kexian 7fd2006d35
change links to english version 2019-10-10 17:06:21 +08:00
Chris Roberts 8bb7d8dc16 Prevent busy loop while waiting for WinRM connection
Set first run variable outside conditional so it will properly be
updated during the first run and pause on subsequent runs.
2019-10-09 17:55:16 -07:00
Megan Marsh 4bc381183d make aws instsance builder work with recent changes for volume copy 2019-10-09 16:59:51 -07:00
Megan Marsh e283023d9b make sure step_register_ami in chroot builder respects encryption and ami skip build retion values once the copy happens 2019-10-09 16:52:41 -07:00