@@ -247,18 +247,18 @@ func (m *Meta) providerDevOverrideRuntimeWarningsRemoteExecution() tfdiags.Diagn
247247 }
248248}
249249
250- // providerFactories uses the selections made previously by an installer in
250+ // ProviderFactories uses the selections made previously by an installer in
251251// the local cache directory (m.providerLocalCacheDir) to produce a map
252- // from provider addresses to factory functions to create instances of
252+ // of provider addresses to factory functions to create instances of
253253// those providers.
254254//
255- // providerFactories will return an error if the installer's selections cannot
255+ // ProviderFactories will return an error if the installer's selections cannot
256256// be honored with what is currently in the cache, such as if a selected
257257// package has been removed from the cache or if the contents of a selected
258258// package have been modified outside of the installer. If it returns an error,
259259// the returned map may be incomplete or invalid, but will be as complete
260260// as possible given the cause of the error.
261- func (m * Meta ) providerFactories () (map [addrs.Provider ]providers.Factory , error ) {
261+ func (m * Meta ) ProviderFactories () (map [addrs.Provider ]providers.Factory , error ) {
262262 locks , diags := m .lockedDependencies ()
263263 if diags .HasErrors () {
264264 return nil , fmt .Errorf ("failed to read dependency lock file: %s" , diags .Err ())
@@ -267,9 +267,16 @@ func (m *Meta) providerFactories() (map[addrs.Provider]providers.Factory, error)
267267 return m .providerFactoriesFromLocks (locks )
268268}
269269
270- func (m * Meta ) providerFactoriesDuringInit (configLocks * depsfile.Locks ) (map [addrs.Provider ]providers.Factory , error ) {
270+ // ProviderFactoriesFromLocks receives in memory locks and uses them to produce a map
271+ // of provider addresses to factory functions to create instances of
272+ // those providers.
273+ //
274+ // ProviderFactoriesFromLocks should only be used if the calling code relies on locks
275+ // that have not yet been persisted to a dependency lock file on disk. Realistically, this
276+ // means only code in the init command should use this method.
277+ func (m * Meta ) ProviderFactoriesFromLocks (configLocks * depsfile.Locks ) (map [addrs.Provider ]providers.Factory , error ) {
271278 // Ensure overrides and unmanaged providers are reflected in the returned list of factories,
272- // while avoiding mutating the in-memory locks.
279+ // while avoiding mutating the in-memory
273280 locks := m .annotateDependencyLocksWithOverrides (configLocks .DeepCopy ())
274281
275282 return m .providerFactoriesFromLocks (locks )
@@ -279,8 +286,8 @@ func (m *Meta) providerFactoriesDuringInit(configLocks *depsfile.Locks) (map[add
279286//
280287// In most cases, calling code should not use this method directly.
281288// Instead, use:
282- // * `providerFactoriesDuringInit ` - for use when locks aren't yet persisted to a dependency lock file.
283- // * `providerFactories ` - for use when Terraform is guaranteed to read all necessary locks from a dependency lock file.
289+ // * `ProviderFactoriesFromLocks ` - for use when locks aren't yet persisted to a dependency lock file.
290+ // * `ProviderFactories ` - for use when Terraform is guaranteed to read all necessary locks from a dependency lock file.
284291func (m * Meta ) providerFactoriesFromLocks (locks * depsfile.Locks ) (map [addrs.Provider ]providers.Factory , error ) {
285292 // We'll always run through all of our providers, even if one of them
286293 // encounters an error, so that we can potentially report multiple errors
0 commit comments