Could not retrieve the list of available versions for provider Terraform Azure
Asked Answered
E

3

19

Based on PR: https://github.com/terraform-providers/terraform-provider-azurerm/pull/5325

azurerm provider version 1.42.0 is required so as to by default install the cosmosdb account with server version 3.6. To achieve this i have added the below in my template which unfortunately fails with the below error.

provider "azurerm" { version = "~> 1.42.0" }

hashicorp/azurerm: no available releases match the given constraints 1.35.0, ~> 1.35.0, ~> 1.42.0, ~> 1.35.0 Could not retrieve the list of available versions for provider

Could someone shed some light into this. What am i missing here

Educational answered 24/8, 2020 at 7:1 Comment(3)
do you need the version 1.x of the terraform provider for other reasons? That this PR was merged for 1.42 just means that it is available in all newer versions as well (unless something on this feature was changed in a later version, of course). Otherwise I would recommend to at least use the lastest 1.x which is 1.44 - or directly go to the current 2.x branchFailing
Further the reason for your particular error is your code base is has multiple provider statements requiring different versions. Raise all your providers to a single version and your issue should resolve.Cromwell
Thanks @silent, Christian Pearce. Both your inputs were correct. 1. I had to remove other lower version of provider specified in the code ie 1.35.0 and replace with the higher version 1.42.0 everywhere. 2. In addition to get the cosmosdb launched with 3.6 version i had to add capability name="EnableMongo".Educational
E
28

Another possibility(i.e. my case) - if you have the plugin binaries saved under $HOME/.terraform.d/plugins/ directory, Terraform won't download their newer versions and provide the message in question instead(tested on v0.13.5).

Rename the directory and check again, it should help. Cheers!

Egypt answered 9/3, 2021 at 15:53 Comment(5)
Wow, that was my case, thnx!Seductress
this solved my issue moving from ARM to intel, the arm version was left and it complained about the version being wrong.Engaged
This solved my issue, thanks!Cowherd
For me what worked was going to the folder of the .tf files go to .terraform and remove everything that was in thereBlackpoll
You're a life-saver !!! I've been forced to use Cloud Shell in GCP for all my terraform operations for the last 2 months because Terraform wouldn't work on my M1 Mac. Thank you for the help ! Upvoted.Lantha
E
9

To get this working i had to remove other references of lower version of the provider specified in other modules and maintain unique provider in every modules.

ie 1.42.0

Both the comments to my question helped.

Educational answered 24/8, 2020 at 19:24 Comment(0)
J
0
  1. Check that you have the correct constraint operator and the correct provider version:
  • minimum provider version: the >= version constraint
  • maximum provider version :the ~> allow only patch releases within a specific minor release
  1. Try deleting everything in the .terraform folder and run
terraform init
  1. Check if you have a directory /Users/ceceteras/.terraform.d/plugins containing some providers.

Unless you want Terraform to use that directory as the only source for providers that exist in it.You do not need that directory named ~/.terraform.d/plugins. Rename the directory to .terraform.d/plugins.old and run terraform init again

Joost answered 7/9, 2023 at 4:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.