terraform-cdk icon indicating copy to clipboard operation
terraform-cdk copied to clipboard

Updating pre-built providers can result in "Failed to query available provider packages" error

Open jsteinich opened this issue 3 years ago • 3 comments

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

  1. Create new cdktf typescript project
  2. npm install @cdktf/[email protected]
  3. Add azuread provider to main.ts
  4. cdktf diff
  5. npm install @cdktf/[email protected]
  6. cdktf diff

References

-https://discuss.hashicorp.com/t/error-failed-to-query-available-provider-packages-locked-provider/40422

jsteinich avatar Jun 11 '22 21:06 jsteinich

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

scottmlikens avatar Jun 14 '22 21:06 scottmlikens

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?

jin-ahn avatar Aug 12 '22 16:08 jin-ahn

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.

jsteinich avatar Aug 12 '22 21:08 jsteinich

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.

github-actions[bot] avatar Dec 15 '22 01:12 github-actions[bot]