command/push: local vars override remote ones
Otherwise once you push a variable it becomes very difficult to change.
This commit is contained in:
parent
a268cc3d81
commit
8ce3e1d5b4
|
@ -132,6 +132,10 @@ func (c *PushCommand) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
for k, v := range vars {
|
||||
// Local variables override remote ones
|
||||
if _, exists := ctx.Variables()[k]; exists {
|
||||
continue
|
||||
}
|
||||
ctx.SetVariable(k, v)
|
||||
}
|
||||
|
||||
|
|
|
@ -205,6 +205,10 @@ func TestPush_inputTfvars(t *testing.T) {
|
|||
defer os.Remove(archivePath)
|
||||
|
||||
client := &mockPushClient{File: archivePath}
|
||||
// Provided vars should override existing ones
|
||||
client.GetResult = map[string]string{
|
||||
"foo": "old",
|
||||
}
|
||||
ui := new(cli.MockUi)
|
||||
c := &PushCommand{
|
||||
Meta: Meta{
|
||||
|
|
Loading…
Reference in New Issue