packer-cn/hcl2template
Adrien Delorme 2af40c762b
HCL2: pass on builder type and name (#8956)
* sets `packer_build_name` and `packer_builder_type` variables for builder provisioners and post-processors in HCL2
* allows to use the new `${source.type}` and `${source.name}` variables in HCL2
* fixes #8932 

Note that the common.PackerConfig is used everywhere and was not set for HCL2, this had some implications: 

For #8923 you can see the issue here:

dde74232f2/builder/lxd/config.go (L61-L63)

More random examples of where this could cause an issue :

0785c2f6fc/provisioner/ansible-local/provisioner.go (L380-L381)

b4efd13a4d/builder/amazon/ebs/builder.go (L232-L236)



* [All references to PackerConfig.PackerBuildName](https://sourcegraph.com/github.com/hashicorp/packer@ff6a039d5bb45e34ff761d9c52e8b98972288447/-/blob/common/packer_config.go#L7:2&tab=references)

* [All references to PackerConfig.PackerBuilderType](https://sourcegraph.com/github.com/hashicorp/packer@ff6a039d5bb45e34ff761d9c52e8b98972288447/-/blob/common/packer_config.go#L8:2&tab=references)
2020-04-09 11:14:37 +02:00
..
function Hcl2 input variables, local variables and functions (#8588) 2020-02-06 11:49:21 +01:00
internal Merge remote-tracking branch 'origin/master' into fix_8730 2020-03-04 12:30:01 +01:00
testdata add more test for var files 2020-03-12 17:08:53 +01:00
common_test.go better testing 2020-03-12 18:01:25 +01:00
decode.go Hcl2 input variables, local variables and functions (#8588) 2020-02-06 11:49:21 +01:00
docs.go Hcl2 input variables, local variables and functions (#8588) 2020-02-06 11:49:21 +01:00
functions.go import new replace and regex replace funcs from go-cty + documentation 2020-03-10 16:14:25 +01:00
parser.go HCL2: pass on builder type and name (#8956) 2020-04-09 11:14:37 +02:00
types.build.from.go build using HCL2 (#8423) 2019-12-17 11:25:56 +01:00
types.build.go give correct error when variable is unset 2020-02-17 17:15:52 +01:00
types.build.post-processor.go HCL2: pass on builder type and name (#8956) 2020-04-09 11:14:37 +02:00
types.build.provisioners.go HCL2: pass on builder type and name (#8956) 2020-04-09 11:14:37 +02:00
types.build_test.go allow to use hcl files as var files in HCL mode 2020-03-12 15:41:40 +01:00
types.hcl_ref.go Hcl2 input variables, local variables and functions (#8588) 2020-02-06 11:49:21 +01:00
types.kv.go NameValues.CopyOn: don't instanciate a receiving map if there is nothing to copy over 2020-03-17 12:00:23 +01:00
types.kv.hcl2spec.go Change key/value to name/value to remain consistent with Terraform 2020-03-17 11:23:11 +01:00
types.packer_config.go HCL2: pass on builder type and name (#8956) 2020-04-09 11:14:37 +02:00
types.packer_config_test.go allow to use hcl files as var files in HCL mode 2020-03-12 15:41:40 +01:00
types.source.go HCL2: pass on builder type and name (#8956) 2020-04-09 11:14:37 +02:00
types.source_test.go allow to use hcl files as var files in HCL mode 2020-03-12 15:41:40 +01:00
types.variables.go packer.io prefix removal, html extension remove for in-code errors 2020-04-07 17:53:22 -04:00
types.variables_test.go add more test for var files 2020-03-12 17:08:53 +01:00
utils.go Hcl2 input variables, local variables and functions (#8588) 2020-02-06 11:49:21 +01:00
zz_retrocompat.go add hcl2template pkg 2019-10-15 12:56:42 +02:00