diff --git a/terraform/context.go b/terraform/context.go index e6b9b4b23..60e5dbea0 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -103,9 +103,6 @@ func NewContext(opts *ContextOpts) *Context { // Setup the variables. We first take the variables given to us. // We then merge in the variables set in the environment. variables := make(map[string]string) - for k, v := range opts.Variables { - variables[k] = v - } for _, v := range os.Environ() { if !strings.HasPrefix(v, VarEnvPrefix) { continue @@ -119,6 +116,9 @@ func NewContext(opts *ContextOpts) *Context { // Override the command-line set variable variables[k] = v } + for k, v := range opts.Variables { + variables[k] = v + } return &Context{ destroy: opts.Destroy,