opentofu/internal/providercache
Martin Atkins 23395a1022 providercache: Discard lock entries for unused providers
Previously we would only ever add new lock entries or update existing
ones. However, it's possible that over time a module may _cease_ using
a particular provider, at which point we ought to remove it from the lock
file so that operations won't fail when seeing that the provider cache
directory is inconsistent with the lock file.

Now the provider installer (EnsureProviderVersions) will remove any lock
file entries that relate to providers not included in the given
requirements, which therefore makes the resulting lock file properly match
the set of packages the installer wrote into the cache.

This does potentially mean that someone could inadvertently defeat the
lock by removing a provider dependency, running "terraform init", then
undoing that removal, and finally running "terraform init" again. However,
that seems relatively unlikely compared to the likelihood of removing
a provider and keeping it removed, and in the event it _did_ happen the
changes to the lock entry for that provider would be visible in the diff
of the provider lock file as usual, and so could be noticed in code
review just as for any other change to dependencies.
2021-12-17 15:30:21 -08:00
..
testdata providercache: More exhaustive testing of the main installer 2020-10-28 07:46:45 -07:00
cached_provider_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
cached_provider.go Move addrs/ to internal/addrs/ 2021-05-17 14:09:07 -07:00
dir_modify_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
dir_modify.go command/init: Read, respect, and update provider dependency locks 2020-10-09 09:26:23 -07:00
dir_test.go addrs: Rename DefaultRegistryHost to DefaultProviderRegistryHost 2021-06-03 08:50:34 -07:00
dir.go tools: remove terraform-bundle. (#28876) 2021-06-03 14:08:04 -04:00
doc.go providercache: A package to encapsulate management of provider cache dirs 2020-03-25 11:29:48 -07:00
installer_events_test.go Move addrs/ to internal/addrs/ 2021-05-17 14:09:07 -07:00
installer_events.go Move addrs/ to internal/addrs/ 2021-05-17 14:09:07 -07:00
installer_test.go providercache: Discard lock entries for unused providers 2021-12-17 15:30:21 -08:00
installer.go providercache: Discard lock entries for unused providers 2021-12-17 15:30:21 -08:00
package_install.go Move httpclient/ to internal/httpclient/ 2021-05-17 14:09:07 -07:00