Updating pre-built providers can result in "Failed to query available provider packages" error
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
cdktf & Language Versions
cdktf 0.10+ any language
Affected Resource(s)
Pre-built providers
Debug Output
40422 Initializing the backend...
40422 Initializing provider plugins...
- Reusing previous version of hashicorp/azuread from the dependency lock file
⠸ Processing
[2022-06-11T16:43:10.133] [ERROR] default - ╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider
│ hashicorp/azuread: locked provider registry.terraform.io/hashicorp/azuread
│ 2.19.1 does not match configured version constraint 2.22.0; must use
│ terraform init -upgrade to allow selection of new versions
Expected Behavior
Commands run successfully
Actual Behavior
Above error as Terraform needs to reinitialize
Steps to Reproduce
- Create new cdktf typescript project
-
npm install @cdktf/[email protected] - Add azuread provider to
main.ts -
cdktf diff -
npm install @cdktf/[email protected] -
cdktf diff
References
-https://discuss.hashicorp.com/t/error-failed-to-query-available-provider-packages-locked-provider/40422
I ran into this myself. The work around does indeed work.
│ Could not retrieve the list of available versions for provider
│ hashicorp/aws: locked provider registry.terraform.io/hashicorp/aws 4.15.1
│ does not match configured version constraint 4.18.0; must use terraform
│ init -upgrade to allow selection of new versions
Fixed by:
cd cdktf.out/stacks/$nameofstack
terraform init -upgrade
I have run into this problem multiple times. Although the solution works fine, its a very annoying to have to do this step manually especially when you have multiple stacks and also multiple people touching the code. Can we have a fix that will do this for us when running cdktf synth? or even a new command like cdktf upgrade?
I have run into this problem multiple times. Although the solution works fine, its a very annoying to have to do this step manually especially when you have multiple stacks and also multiple people touching the code. Can we have a fix that will do this for us when running cdktf synth? or even a new command like cdktf upgrade?
I've been working on such a fix and a new command is tracked by #1745.
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. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.