Error on init: "No available releases match constraints"

Hi I am also having the same issue. However we are using Terraform Workspace cloud so I do not have direct control on moving the plugins providers.

I do have required providers defined in the modules.
Furthermore, I would like to use 1.14 and this is the error I see:

│ Error: Failed to query available provider packages

│ Could not retrieve the list of available versions for provider
│ gavinbunney/kubectl: no available releases match the given constraints
│ 1.10.0, >= 1.14.0, 1.14.0

If I only use 1.10 it does install but I am trying to use the for_each in data kubectl_file_documents.

Any idea?

This looks like you have multiple constraints for the gavinbunney/kubectl provider:

  • 1.10.0, i.e. “must be exactly 1.10.0”
  • >= 1.14.0, i.e. “must be at least 1.14.0”
  • 1.14.0, i.e. “must be exactly 1.14.0”

This combination cannot ever be satisfied, which is why Terraform cannot be initialized.

If you look through the required_providers blocks for your configuration and its modules, I think you’ll find each of these provider constraints somewhere. To upgrade to 1.14.0, you’ll have to update the configuration which requires 1.10.0.

Good catch on the inability to match semantic versioning.

I do have several modules that requires source = "1.10.0".

Pardon my inexperience but is there a way to use several Provider versions for each module?

In my top-level workspace, could I do something like:

terraform {
  required_providers {
    kubectl = {
      source  = "gavinbunney/kubectl"
      version = "1.10.0, ~>1.14.0"
    }
  }
}

My guess is no. But I just wanted to get your take on it.

Thanks!

Hi @jackchi,

Because provider configurations are often shared across modules, Terraform requires only a single version of each provider in an entire configuration. It isn’t possible to use the same provider at two different versions at the same time.

I am still getting the similar error message.
Error Message:

Could not retrieve the list of available versions for provider hashicorp/google: 
no available releases match the given constraints >= 2.12.0, ~> 3.6, >= 3.43.0, ~>3.45, < 4.0.0, >= 4.25.0, < 5.0.0

This is how my gke.tf file looks like:

  module "gcp-network" {
  source       = "terraform-google-modules/network/google"
  version      = "~> 2.5"
  project_id   = var.project_id
  network_name = "${var.network}-${var.env_name}"

main.tf >>

 terraform {
  required_version = ">= 0.14"
  required_providers {
   google = "~> 3.6"
  }
 }   

This list is impossible to satisfy in multiple ways - for example it demands a version which is simultaneously less than 4.0 and greater than 4.25, which is impossible to satisfy