How to purge an unused old provider in a lock file

Hi @lens0021,

There isn’t an automatic way to purge it, because Terraform is trying to keep hold of these previously-learned hashes in case you removed the provider in error and want to add it back again.

However, if you know you will no longer be using the provider at its old address, it would be safe to edit the file and delete the corresponding block.

Terraform doesn’t make use of the information in the lock file unless the provider installation process determines that it needs to install a particular provider that’s already recorded in there, so that extra entry won’t affect Terraform’s behavior in any significant way unless you were to re-add the old address to your configuration later, although as you saw terraform version does happen to use it to produce its extra information about which specific providers are selected, which is a cosmetic thing only.

1 Like