2014-06-27 02:05:21 +02:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
type UiHook struct {
|
|
|
|
terraform.NilHook
|
|
|
|
|
|
|
|
Ui cli.Ui
|
|
|
|
}
|
|
|
|
|
2014-06-27 02:18:46 +02:00
|
|
|
func (h *UiHook) PreDiff(
|
|
|
|
id string, s *terraform.ResourceState) (terraform.HookAction, error) {
|
|
|
|
h.Ui.Output(fmt.Sprintf("Calculating diff for %s", id))
|
|
|
|
return terraform.HookActionContinue, nil
|
|
|
|
}
|
|
|
|
|
2014-06-27 02:05:21 +02:00
|
|
|
func (h *UiHook) PreRefresh(
|
|
|
|
id string, s *terraform.ResourceState) (terraform.HookAction, error) {
|
|
|
|
h.Ui.Output(fmt.Sprintf("Refreshing state for %s (ID: %s)", id, s.ID))
|
|
|
|
return terraform.HookActionContinue, nil
|
|
|
|
}
|