SIGN IN SIGN UP
hashicorp / terraform UNCLAIMED

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.

0 0 20 Go

init: Make both provider override methods (dev_overrides and reattaching providers) behave same in the context of provider download (#38634)

This PR makes a few related changes:

1. Construct provider cache Installers so they have knowledge about dev_override providers

Prior to this change, providercache.Installer variables were made in the command package with knowledge about reattached/unmanaged providers, but not with knowledge about dev_override providers. Now both sets of overridden providers are present in the installer and can affect installation logic.

2. Make the provider installation logic skip any dev_override providers from being installed from the Registry (or other configured sources)

This means that if a provider is first added to a config while someone uses a dev_override an init command will not add that provider to the lock file. If the overridden provider is already in the lock file then the lock will be unchanged. An edge case, that already exists for unmanaged providers, is that if a dev_override is in play while an init -upgrade command is used, only the providers that aren't overridden or unmanaged will be upgraded

This change is coupled to another change in the PR described below.

3. Fix the provider download process (in context of init) so that dev_overrides are not removed from the provider requirements. 

This reverts a change in https://github.com/hashicorp/terraform/pull/37884. The original motivation of that PR was to address a situation where the provider supplied by dev_overrides isn't published to the Registry yet. The config may need to include an entry in required_providers for that provider, which means that init would always fail due to the provider being unavailable in the Registry for download. The prior commit (bfc08b5d96) changed installer logic to skip dev_override providers, which cancels out this commit's changes; dev_override providers will remain in the provider requirements passed to installation logic, but that logic will now ignore them. As a consequence of no longer removing these provider requirements we will retain any pre-existing locks for the provider through the init process.

4. The `providers locks` command will now warn users about any dev_overrides in effect, as these will stop provider locks from being downloaded.
S
Sarah French committed
234ef96aecbd971fe3062eca53337e95b4cd200f
Parent: 81053e9
Committed by GitHub <noreply@github.com> on 5/27/2026, 3:06:40 PM