Vaishnav
Vaishnav

Reputation: 711

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

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

Upvotes: 23

Views: 94142

Answers (3)

Duru Cynthia Udoka
Duru Cynthia Udoka

Reputation: 767

  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

Upvotes: 0

Kamil Kalinowski
Kamil Kalinowski

Reputation: 486

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!

Upvotes: 31

Vaishnav
Vaishnav

Reputation: 711

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.

Upvotes: 9

Related Questions