Merge pull request #1881 from hashicorp/b-push-var-override

command/push: local vars override remote ones
This commit is contained in:
Paul Hinze 2015-05-08 18:59:52 -05:00
commit 66077556a5
2 changed files with 8 additions and 0 deletions

View File

@ -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)
}

View File

@ -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{