terraform: env vars are lower priority
This commit is contained in:
parent
fe74d69852
commit
0728e25f43
|
@ -103,9 +103,6 @@ func NewContext(opts *ContextOpts) *Context {
|
||||||
// Setup the variables. We first take the variables given to us.
|
// Setup the variables. We first take the variables given to us.
|
||||||
// We then merge in the variables set in the environment.
|
// We then merge in the variables set in the environment.
|
||||||
variables := make(map[string]string)
|
variables := make(map[string]string)
|
||||||
for k, v := range opts.Variables {
|
|
||||||
variables[k] = v
|
|
||||||
}
|
|
||||||
for _, v := range os.Environ() {
|
for _, v := range os.Environ() {
|
||||||
if !strings.HasPrefix(v, VarEnvPrefix) {
|
if !strings.HasPrefix(v, VarEnvPrefix) {
|
||||||
continue
|
continue
|
||||||
|
@ -119,6 +116,9 @@ func NewContext(opts *ContextOpts) *Context {
|
||||||
// Override the command-line set variable
|
// Override the command-line set variable
|
||||||
variables[k] = v
|
variables[k] = v
|
||||||
}
|
}
|
||||||
|
for k, v := range opts.Variables {
|
||||||
|
variables[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
return &Context{
|
return &Context{
|
||||||
destroy: opts.Destroy,
|
destroy: opts.Destroy,
|
||||||
|
|
Loading…
Reference in New Issue