command/diff: show diff string output

This commit is contained in:
Mitchell Hashimoto 2014-06-10 11:34:08 -07:00
parent 469d20afe3
commit c81e3f4db7
1 changed files with 9 additions and 1 deletions

View File

@ -42,12 +42,20 @@ func (c *DiffCommand) Run(args []string) int {
tfconfig := c.TFConfig tfconfig := c.TFConfig
tfconfig.Config = b tfconfig.Config = b
_, err = terraform.New(tfconfig) tf, err := terraform.New(tfconfig)
if err != nil { if err != nil {
c.Ui.Error(fmt.Sprintf("Error initializing Terraform: %s", err)) c.Ui.Error(fmt.Sprintf("Error initializing Terraform: %s", err))
return 1 return 1
} }
diff, err := tf.Diff(nil)
if err != nil {
c.Ui.Error(fmt.Sprintf("Error running diff: %s", err))
return 1
}
c.Ui.Output(strings.TrimSpace(diff.String()))
return 0 return 0
} }