3
votes

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

2
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 branchsilent
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.Christian Pearce
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".Vaishnav

2 Answers

2
votes

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!

1
votes

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.