diff --git a/terraform/context_test.go b/terraform/context_test.go index 90ec09f8ff..e3e1aa6467 100644 --- a/terraform/context_test.go +++ b/terraform/context_test.go @@ -3252,8 +3252,7 @@ func TestContext2Apply_Provisioner_compute(t *testing.T) { } } -/* -func TestContextApply_provisionerCreateFail(t *testing.T) { +func TestContext2Apply_provisionerCreateFail(t *testing.T) { m := testModule(t, "apply-provisioner-fail-create") p := testProvider("aws") pr := testProvisioner() @@ -3267,7 +3266,7 @@ func TestContextApply_provisionerCreateFail(t *testing.T) { return is, fmt.Errorf("error") } - ctx := testContext(t, &ContextOpts{ + ctx := testContext2(t, &ContextOpts{ Module: m, Providers: map[string]ResourceProviderFactory{ "aws": testProviderFuncFixed(p), @@ -3293,6 +3292,7 @@ func TestContextApply_provisionerCreateFail(t *testing.T) { } } +/* func TestContextApply_provisionerCreateFailNoId(t *testing.T) { m := testModule(t, "apply-provisioner-fail-create") p := testProvider("aws") diff --git a/terraform/eval_apply.go b/terraform/eval_apply.go index dd77b81454..ab85e71bef 100644 --- a/terraform/eval_apply.go +++ b/terraform/eval_apply.go @@ -46,6 +46,12 @@ func (n *EvalApply) Eval( } } + // If the state is nil, make it non-nil + if state == nil { + state = new(InstanceState) + } + state.init() + { // Call pre-apply hook err := ctx.Hook(func(h Hook) (HookAction, error) {