Commit Graph

4 Commits

Author SHA1 Message Date
Megan Marsh da53ac99be when using a slice of an imported field type, the Underlying still returned the slice rather than the element type. 2019-10-23 15:08:14 -07:00
Adrien Delorme f6af5ecf07 Update mapstructure-to-hcl2.go
make log/usage prompt prefix coherent
2019-10-16 10:49:20 +02:00
Adrien Delorme 9dac7908a5 Update mapstructure-to-hcl2.go
better comments
2019-10-15 15:25:01 +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