-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Option to upgrade to latest available provider versions as part of "terraform providers lock" #27388
Comments
Hi @thomasboussekey! You describe your issue as Could you try to describe the issue you're seeing (the bug in Terraform you are describing) with a simplified configuration so we might be able to reproduce the issue? |
Hi @pselle,
In the The main command in question in this issue is
I have updated the providers on 5 different terraform project and I didn't face the problem described above in the 5 cases. I didn't manage to identify a common root cause, that can trigger the problem. Here is a more concise description of the problem:
I will try to build a simple project in which I face this issue.... 🤞 |
Hi @thomasboussekey I found recently that if this var is set, terraform not fully updates lock file #27135 (comment) |
Hi @nantiferov I've searched on the Internet to see if we can enrich our configuration in order to cache providers for multiple sources. |
@thomasboussekey I really like this feature with lock files in general. But it definitely should be improved. So far I was able to fix this issue for me by hiding TF_PLUGIN_CACHE_DIR during Wrapper logic:
|
As others have said, the local cache directory does unfortunately prevent If your intent is to run both If that's true, then I wonder if we could address this use-case by adding a similar
If your only goal was to get the lock file updated then it would then not be necessary to run Inverting the two should work here because If that would be an acceptable solution to your current use-case, I'd like to use this issue to represent improving |
Thank you @apparentlymart for so detailed comment.
But in this case
AFAIK it actually uses. In my case I was able to create a correct lock file with
I think that it would be nice to have an option in terraform init command to define what providers should be added to lock file. My goals is that lock file is generated at the first run of terraform init with correct hashes and for both platforms. |
Would it be possible to have a reliable way of disabling Using I was working around this with: TF_PLUGIN_CACHE_DIR="" \
TF_CLI_CONFIG_FILE=terraform-upgrade.hcl \
tf -chdir=project init -upgrade where plugin_cache_dir="" However, I've now had to temporarily disable provider locking. I'm maintaining dozens of terraform projects, all of them with lots of providers. Not using the cache means to even update a single provider across all projects blocks Terraform for a good 20 minutes while my slow home internet pointlessly redownloads each provider repeatedly for every project. Hopefully #27264 will be resolved soon. |
Thank you @apparentlymart , @nantiferov and @xM8WVqaG for your contributions, I worked on this issue and tried to implement @xM8WVqaG workaround, in my I will follow the issue #27264, expecting it will ease our provider's version management 🤞 Have a nice week-end, |
Eager to solve this issue, I managed to refresh the provider at the awaited version with a single GNU make recipe refresh_providers:
$(TERRAFORM) init -upgrade
$(TERRAFORM) providers lock -platform=linux_amd64
$(TERRAFORM) providers lock -platform=darwin_amd64 -platform=linux_amd64
Content of the
|
Just ran into this on the latest terraform version (currently This makes updating provider dependencies painful, as now I have to run the following commands every time I want to update provider dependencies in a single folder (there are many folders):
Unfortunately if I don't use plugin cache, things can be really slow locally... so there really isn't a great workaround for me at the moment other than writing a script to do this for me. |
Duplicated by #27810 |
oh good, I thought I was alone in this |
Hi my friends! |
Terraform Version
Terraform Configuration Files
Debug Output
None
Crash Output
None
Expected Behavior
Want to update terraform providers to a fresher version as provided in the configuration.
Actual Behavior
Unable to change the version of the providers
I found a workaround: deleting and re-creating the provider dependency lock file
Steps to Reproduce
make recipe
to perform aterraform init -upgrade
to upgrade providers for Linux & DarwinMake recipe:
I have the following output:
Workaround to perform the provider upgrade
Fix step 0,Remove the lock file
$ mv .terraform.lock.hcl .terraform.lock.hcl.old
Fix step 1, using a single platform provider
Fix step 2, Add the second platform
Fix step 3, Remove the backup terraform lock file
Additional Context
References
The text was updated successfully, but these errors were encountered: