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.
refactor: Move validation of `init`'s `-upgrade` and `-lockfile=readonly` flags to the arguments package. (#38561)
The `-upgrade` and `-lockfile=readonly` flags are mutually exclusive, and this is now enforced by the arguments package. This refactor has also fixed a historical bug where that validation error was output twice. The getProvidersFromConfig code now depends on the flag validation happening in the calling code. However there is another check in downstream code, in `saveDependencyLockFile` when we overwrite the dependency lock file's contents. There, an error occurs if a diff in the locks is detected during `readonly` mode. This protects against incorrect use of `getProvidersFromConfig` with unvalidated inputs, if that happens in future.
S
Sarah French committed
c56ec2943d17922e1d7213d709995d9de983dcf3
Parent: 2e5a89a
Committed by GitHub <noreply@github.com>
on 5/14/2026, 1:42:31 PM