command/output: Absence of outputs is not an error

This commit is contained in:
Josh Grancell 2019-11-06 19:26:32 -05:00 committed by Martin Atkins
parent 21228b473a
commit ac3578a0bc
2 changed files with 5 additions and 5 deletions

View File

@ -120,7 +120,7 @@ func (c *OutputCommand) Run(args []string) int {
"become available. If you are using interpolation, please verify\n" +
"the interpolated value is not empty. You can use the \n" +
"`terraform console` command to assist.")
return 1
return 0
}
if name == "" {

View File

@ -136,7 +136,7 @@ func TestOutput_emptyOutputsErr(t *testing.T) {
args := []string{
"-state", statePath,
}
if code := c.Run(args); code != 1 {
if code := c.Run(args); code != 0 {
t.Fatalf("bad: \n%s", ui.ErrorWriter.String())
}
}
@ -292,7 +292,7 @@ func TestOutput_noArgs(t *testing.T) {
}
args := []string{}
if code := c.Run(args); code != 1 {
if code := c.Run(args); code != 0 {
t.Fatalf("bad: \n%s", ui.OutputWriter.String())
}
}
@ -313,7 +313,7 @@ func TestOutput_noState(t *testing.T) {
"-state", statePath,
"foo",
}
if code := c.Run(args); code != 1 {
if code := c.Run(args); code != 0 {
t.Fatalf("bad: \n%s", ui.ErrorWriter.String())
}
}
@ -335,7 +335,7 @@ func TestOutput_noVars(t *testing.T) {
"-state", statePath,
"bar",
}
if code := c.Run(args); code != 1 {
if code := c.Run(args); code != 0 {
t.Fatalf("bad: \n%s", ui.ErrorWriter.String())
}
}