diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go index 2538832af..8b3b674de 100644 --- a/builder/amazon/chroot/builder.go +++ b/builder/amazon/chroot/builder.go @@ -52,6 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { if err != nil { return err } + b.config.tpl.UserVars = b.config.PackerUserVars // Defaults if b.config.ChrootMounts == nil { diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go index 018e9d1f1..65189cb14 100644 --- a/builder/amazon/ebs/builder.go +++ b/builder/amazon/ebs/builder.go @@ -45,6 +45,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { if err != nil { return err } + b.config.tpl.UserVars = b.config.PackerUserVars // Accumulate any errors errs := common.CheckUnusedConfig(md) diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index e3e4460c0..50cc0833e 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -55,6 +55,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { if err != nil { return err } + b.config.tpl.UserVars = b.config.PackerUserVars if b.config.BundleDestination == "" { b.config.BundleDestination = "/tmp" diff --git a/builder/digitalocean/builder.go b/builder/digitalocean/builder.go index 39314b8c2..ac383be0c 100644 --- a/builder/digitalocean/builder.go +++ b/builder/digitalocean/builder.go @@ -61,6 +61,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { if err != nil { return err } + b.config.tpl.UserVars = b.config.PackerUserVars // Accumulate any errors errs := common.CheckUnusedConfig(md) diff --git a/builder/virtualbox/builder.go b/builder/virtualbox/builder.go index 1bdc6c5fc..d4b6f57db 100644 --- a/builder/virtualbox/builder.go +++ b/builder/virtualbox/builder.go @@ -70,6 +70,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { if err != nil { return err } + b.config.tpl.UserVars = b.config.PackerUserVars // Accumulate any errors errs := common.CheckUnusedConfig(md) diff --git a/builder/vmware/builder.go b/builder/vmware/builder.go index fd27d20c0..9679d6627 100644 --- a/builder/vmware/builder.go +++ b/builder/vmware/builder.go @@ -71,6 +71,7 @@ func (b *Builder) Prepare(raws ...interface{}) error { if err != nil { return err } + b.config.tpl.UserVars = b.config.PackerUserVars // Accumulate any errors errs := common.CheckUnusedConfig(md) diff --git a/provisioner/file/provisioner.go b/provisioner/file/provisioner.go index ea958dba0..27e217983 100644 --- a/provisioner/file/provisioner.go +++ b/provisioner/file/provisioner.go @@ -9,6 +9,8 @@ import ( ) type config struct { + common.PackerConfig `mapstructure:",squash"` + // The local path of the file to upload. Source string @@ -32,6 +34,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { if err != nil { return err } + p.config.tpl.UserVars = p.config.PackerUserVars // Accumulate any errors errs := common.CheckUnusedConfig(md) diff --git a/provisioner/shell/provisioner.go b/provisioner/shell/provisioner.go index fb30422e5..1c6b1272d 100644 --- a/provisioner/shell/provisioner.go +++ b/provisioner/shell/provisioner.go @@ -17,6 +17,8 @@ import ( const DefaultRemotePath = "/tmp/script.sh" type config struct { + common.PackerConfig `mapstructure:",squash"` + // An inline script to execute. Multiple strings are all executed // in the context of a single shell. Inline []string @@ -43,10 +45,6 @@ type config struct { // can be used to inject the environment_vars into the environment. ExecuteCommand string `mapstructure:"execute_command"` - // Packer configurations, these come from Packer itself - PackerBuildName string `mapstructure:"packer_build_name"` - PackerBuilderType string `mapstructure:"packer_builder_type"` - tpl *common.Template } @@ -69,6 +67,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { if err != nil { return err } + p.config.tpl.UserVars = p.config.PackerUserVars // Accumulate any errors errs := common.CheckUnusedConfig(md)