terraform: state must not be nil for apply

This commit is contained in:
Mitchell Hashimoto 2015-02-13 09:53:33 -08:00
parent b8e5690565
commit 79746cb35d
2 changed files with 9 additions and 3 deletions

View File

@ -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")

View File

@ -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) {