diff --git a/terraform/context.go b/terraform/context.go index 22ff57cec4..28dd0d5f96 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -551,8 +551,8 @@ func (c *walkContext) applyWalkFn() depgraph.WalkFunc { // was an error during the provider apply. tainted := false if applyerr == nil && createNew && len(r.Provisioners) > 0 { - for _, h := range c.hooks { - handleHook(h.PreProvisionResource(r.Id, is)) + for _, h := range c.Context.hooks { + handleHook(h.PreProvisionResource(r.Info, is)) } if err := c.applyProvisioners(r, is); err != nil { diff --git a/terraform/context_test.go b/terraform/context_test.go index acb8d0367e..25cb94e745 100644 --- a/terraform/context_test.go +++ b/terraform/context_test.go @@ -797,7 +797,7 @@ func TestContextApply_provisionerResourceRef(t *testing.T) { // Provisioner should NOT run on a diff, only create func TestContextApply_Provisioner_Diff(t *testing.T) { - c := testConfig(t, "apply-provisioner-diff") + m := testModule(t, "apply-provisioner-diff") p := testProvider("aws") pr := testProvisioner() p.ApplyFn = testApplyFn @@ -806,7 +806,7 @@ func TestContextApply_Provisioner_Diff(t *testing.T) { return nil } ctx := testContext(t, &ContextOpts{ - Config: c, + Module: m, Providers: map[string]ResourceProviderFactory{ "aws": testProviderFuncFixed(p), }, @@ -842,7 +842,7 @@ func TestContextApply_Provisioner_Diff(t *testing.T) { // Re-create context with state ctx = testContext(t, &ContextOpts{ - Config: c, + Module: m, Providers: map[string]ResourceProviderFactory{ "aws": testProviderFuncFixed(p), },