diff --git a/terraform/eval_import_state.go b/terraform/eval_import_state.go index c85ab8aa9..afde2d3ff 100644 --- a/terraform/eval_import_state.go +++ b/terraform/eval_import_state.go @@ -17,7 +17,17 @@ type EvalImportState struct { func (n *EvalImportState) Eval(ctx EvalContext) (interface{}, error) { provider := *n.Provider - // Refresh! + { + // Call pre-import hook + err := ctx.Hook(func(h Hook) (HookAction, error) { + return h.PreImportState(n.Info) + }) + if err != nil { + return nil, err + } + } + + // Import! state, err := provider.ImportState(n.Info) if err != nil { return nil, fmt.Errorf( @@ -28,5 +38,15 @@ func (n *EvalImportState) Eval(ctx EvalContext) (interface{}, error) { *n.Output = state } + { + // Call post-import hook + err := ctx.Hook(func(h Hook) (HookAction, error) { + return h.PostImportState(n.Info, state) + }) + if err != nil { + return nil, err + } + } + return nil, nil }