@@ -392,7 +392,7 @@ const (
392392// The dependency lock file itself isn't updated here.
393393//
394394// Calling code is responsible for validating inputs to this method, e.g. mutually exclusive flags.
395- func (c * InitCommand ) getProvidersFromConfig (ctx context.Context , config * configs.Config , upgrade bool , pluginDirs []string , flagLockfile string , view views.Init , installerHook * providerInstallerHook ) (output bool , resultingLocks * depsfile.Locks , safeInitAction SafeInitAction , authResult * getproviders.PackageAuthenticationResult , diags tfdiags.Diagnostics ) {
395+ func (c * InitCommand ) getProvidersFromConfig (ctx context.Context , config * configs.Config , upgrade bool , pluginDirs []string , flagLockfile string , view views.Init , installerHook * providerPolicyHook ) (output bool , resultingLocks * depsfile.Locks , safeInitAction SafeInitAction , authResult * getproviders.PackageAuthenticationResult , diags tfdiags.Diagnostics ) {
396396 if config == nil {
397397 return false , nil , SafeInitActionNotRelevant , nil , diags
398398 }
@@ -515,7 +515,6 @@ func (c *InitCommand) getProvidersFromConfig(ctx context.Context, config *config
515515 ProvidersFetched : providersFetchedCallback (view ),
516516 }
517517 ctx = evts .OnContext (ctx )
518- inst .SetHook (installerHook )
519518
520519 mode := providercache .InstallNewProvidersOnly
521520 if upgrade {
@@ -531,7 +530,7 @@ func (c *InitCommand) getProvidersFromConfig(ctx context.Context, config *config
531530
532531 // Determine which required providers are already downloaded, and download any
533532 // new providers or newer versions of providers
534- configLocks , installErr := inst .EnsureProviderVersions (ctx , previousLocks , reqs , mode )
533+ configLocks , installErr := inst .EnsureProviderVersions (ctx , previousLocks , reqs , mode , installerHook )
535534 if ctx .Err () == context .Canceled {
536535 diags = diags .Append (fmt .Errorf ("Provider installation was canceled by an interrupt signal." ))
537536 view .Diagnostics (diags ) // TODO: Why is the output viewed here?
@@ -590,7 +589,7 @@ func (c *InitCommand) getProvidersFromConfig(ctx context.Context, config *config
590589// The calling code is assumed to have already called getProvidersFromConfig, which is used to
591590// supply the configLocks argument.
592591// The dependency lock file itself isn't updated here.
593- func (c * InitCommand ) getProvidersFromState (ctx context.Context , state * states.State , configReqs providerreqs.Requirements , configLocks * depsfile.Locks , pluginDirs []string , view views.Init , installerHook * providerInstallerHook ) (output bool , resultingLocks * depsfile.Locks , diags tfdiags.Diagnostics ) {
592+ func (c * InitCommand ) getProvidersFromState (ctx context.Context , state * states.State , configReqs providerreqs.Requirements , configLocks * depsfile.Locks , pluginDirs []string , view views.Init , installerHook * providerPolicyHook ) (output bool , resultingLocks * depsfile.Locks , diags tfdiags.Diagnostics ) {
594593 ctx , span := tracer .Start (ctx , "install providers from state" )
595594 defer span .End ()
596595
@@ -695,7 +694,6 @@ func (c *InitCommand) getProvidersFromState(ctx context.Context, state *states.S
695694 ProvidersFetched : providersFetchedCallback (view ),
696695 }
697696 ctx = evts .OnContext (ctx )
698- inst .SetHook (installerHook )
699697
700698 mode := providercache .InstallNewProvidersOnly
701699
@@ -705,7 +703,7 @@ func (c *InitCommand) getProvidersFromState(ctx context.Context, state *states.S
705703 // would remove the effects of version constraints from the config.
706704 // > Any validation of CLI flag usage is already done in getProvidersFromConfig
707705
708- newLocks , err := inst .EnsureProviderVersions (ctx , inProgressLocks , reqs , mode )
706+ newLocks , err := inst .EnsureProviderVersions (ctx , inProgressLocks , reqs , mode , installerHook )
709707 if ctx .Err () == context .Canceled {
710708 diags = diags .Append (fmt .Errorf ("Provider installation was canceled by an interrupt signal." ))
711709 view .Diagnostics (diags )
0 commit comments