From 7cb31714ad8868e7e97ec4714bc1e973c6537a5e Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 7 Mar 2019 09:37:31 -0800 Subject: [PATCH] Allow user variables to be interpreted within the variables section of the template. --- packer/core.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packer/core.go b/packer/core.go index d88e21e5c..cd6c6ae34 100644 --- a/packer/core.go +++ b/packer/core.go @@ -303,7 +303,7 @@ func (c *Core) init() error { // Go through the variables and interpolate the environment variables ctx := c.Context() ctx.EnableEnv = true - ctx.UserVariables = nil + ctx.UserVariables = make(map[string]string) for k, v := range c.Template.Variables { // Ignore variables that are required if v.Required { @@ -324,6 +324,7 @@ func (c *Core) init() error { } c.variables[k] = def + ctx.UserVariables = c.variables } for _, v := range c.Template.SensitiveVariables {