diff --git a/terraform/context_test.go b/terraform/context_test.go index 92e13c0bc..08fc93df1 100644 --- a/terraform/context_test.go +++ b/terraform/context_test.go @@ -98,11 +98,10 @@ func TestContext2Refresh_delete(t *testing.T) { } } -/* -func TestContextRefresh_ignoreUncreated(t *testing.T) { +func TestContext2Refresh_ignoreUncreated(t *testing.T) { p := testProvider("aws") m := testModule(t, "refresh-basic") - ctx := testContext(t, &ContextOpts{ + ctx := testContext2(t, &ContextOpts{ Module: m, Providers: map[string]ResourceProviderFactory{ "aws": testProviderFuncFixed(p), @@ -124,6 +123,7 @@ func TestContextRefresh_ignoreUncreated(t *testing.T) { } } +/* func TestContextRefresh_hook(t *testing.T) { h := new(MockHook) p := testProvider("aws") diff --git a/terraform/eval_refresh.go b/terraform/eval_refresh.go index cf5876acc..a0d9d4b34 100644 --- a/terraform/eval_refresh.go +++ b/terraform/eval_refresh.go @@ -22,6 +22,11 @@ func (n *EvalRefresh) Eval( state = args[1].(*InstanceState) } + // If we have no state, we don't do any refreshing + if state == nil { + return nil, nil + } + n.Info.ModulePath = ctx.Path() return provider.Refresh(n.Info, state) }