-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
providers mirror
doesn't use lock file
#28274
Comments
Hi @ThinkChaos, thanks for submitting this! I will re-label this as an enhancement request. Thanks again! |
Thank you for the response. Reading the docs it is not clear to me that mirroring is meant to be done before init, and tutorials I could find on this subject also use it
I'd argue that the lockfile is part of the configuration. And it can contain multiple platforms if you run
The goal is the opposite, but I wasn't quite clear in the original comment so I'll explain a bit more. To mirror the providers, we use That's what the example I originally posted reproduces: a new version coming out after the lockfile is generated. Now that I have a better understanding of the intended role of Anyways, our current workaround is to use specific versions in our |
Thank for raising it @ThinkChaos , Same for me, I thought that It would be great if it takes into consideration the lock file instead of pinning specific versions. |
It just does not make any sense at all to not respect the lockfile and also not providing any switch for it to enable/disable. The problem is not only that the mirror download is not respecting the lock file, the problem is that the terraform init -plugin-dir=... command that is supposed to follow is respecting that lockfile and therefore complains about missing versions. The entire section in the documentation is rendered useless by this. Enhancement label should be removed and replaced by documentation and bugfix labels. |
Thanks for all the feedback on this issue. We discussed the issue internally and would be happy to review a PR which meets the following design, which is very close to the proposals in this thread: Update the
As with all PRs, this should include test coverage, which in the case of this command means adding a new If anyone would like to work on such a PR, please do go ahead and link to it in this thread. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Terraform Version
0.14.9 / 0.15.0-beta2
Expected Behavior
When running
terraform providers mirror
in a directory with a.terraform.lock.hcl
, I'd expect the downloaded providers to be the ones specified in the lock file.Actual Behavior
The downloaded providers are not the ones specified in the lock file.
Steps to Reproduce
Thoughts on Fix
I think there are some minor design questions to answer before this can be fixed:
What should happen when there is a lock file but some providers are not in it?
providers lock
What should happen when the constraint and lock file conflict?
I imagine this would cause an error asking the user to update the lock file.
Besides those questions I believe the fix would look something like this:
In command/providers_mirror.go:
c.lockedDependencies()
selected
(see line 141)Disclaimer: I'm new to using TF and only took a quick look at the code, so I probably got some things wrong and am missing context.
The text was updated successfully, but these errors were encountered: