terraform/internal/depsfile
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/locks-files depsfile: Flatten the "hashes" locks to a single set of strings 2020-09-24 14:01:54 -07:00
doc.go internal/depsfile: Loading locks from HCL files on disk 2020-09-08 09:50:58 -07:00
locks.go providercache: Discard lock entries for unused providers 2021-12-17 15:30:21 -08:00
locks_file.go depsfile: SaveLocksToBytes function 2021-10-01 14:43:58 -07:00
locks_file_test.go Move addrs/ to internal/addrs/ 2021-05-17 14:09:07 -07:00
locks_test.go providercache: Discard lock entries for unused providers 2021-12-17 15:30:21 -08:00
paths.go internal/depsfile: Loading locks from HCL files on disk 2020-09-08 09:50:58 -07:00
testing.go command/init: Read, respect, and update provider dependency locks 2020-10-09 09:26:23 -07:00