Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providercache: Discard lock entries for unused providers #30192

Merged
merged 1 commit into from
Dec 17, 2021

Commits on Dec 17, 2021

  1. 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.
    apparentlymart committed Dec 17, 2021
    Configuration menu
    Copy the full SHA
    df4f86c View commit details
    Browse the repository at this point in the history