command/diff: show diff string output
This commit is contained in:
parent
469d20afe3
commit
c81e3f4db7
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue