terraform-google-modules/terraform-google-gcloud

Unable to retrieve list of available versions for hashicorp/google provider with specific constraints.

fveas opened this issue ยท 5 comments

fveas commented

TL;DR

When attempting to initialize Terraform with specific version constraints for the hashicorp/google provider, an error is encountered indicating that no available versions match the given constraints.

Expected behavior

Terraform should successfully initialize, or provide a clear error message indicating incompatible version constraints.

Observed behavior

Received the error: "Could not retrieve the list of available versions for provider hashicorp/google: no available releases match the given constraints >= 3.39.0, >= 3.43.0, >= 3.53.0, >= 4.0.0, >= 4.38.0, >= 4.42.0, ~> 5.0, < 5.0.0, >=5.1.0, < 6.0.0".

Terraform Configuration

terraform {
  required_providers {
    google = {
      source  = "hashicorp/google"
      version = ">= 5.0.0"
    }
  }
  required_version = ">= 1.3.5"
}

Terraform Version

Terraform v1.5.7
on darwin_amd64
+ provider registry.terraform.io/hashicorp/external v2.3.1
+ provider registry.terraform.io/hashicorp/google v4.84.0
+ provider registry.terraform.io/hashicorp/google-beta v4.84.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.23.0
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/hashicorp/random v3.5.1

Your version of Terraform is out of date! The latest version
is 1.6.0. You can update by downloading from https://www.terraform.io/downloads.html

Steps to reproduce

  1. Configure the provider.tf (or relevant filename) with the following version constraints for the hashicorp/google provider:
    >= 5.0.0
  2. Run terraform init.
  3. Observe the error message.

Additional information

I was looking into this error where they report a similar issue: #171.

Hi @fveas - There appears to be something in your terraform configuration which includes a hashicorp/google < 5.0.0 constraint. I'd suggest confirming you are using terraform-google-gcloud ~> 3.3, and then get the output of terraform providers (you might need to temporarily remove your version = ">= 5.0.0" to first run terraform init --upgrade) .

fveas commented

Hello @apeabody, I've made the changes you requested, but I'm still encountering issues. Here's the output from terraform providers:

Providers required by configuration:
.
โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] 5.1.0
โ”œโ”€โ”€ module.app
โ”‚   โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/random] ~> 3.1
โ”‚   โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] 5.1.0
โ”‚   โ”œโ”€โ”€ module.bucket
โ”‚   โ”‚   โ””โ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 4.42.0, < 5.0.0
โ”‚   โ”œโ”€โ”€ module.secret-manager
โ”‚   โ”‚   โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google-beta] >= 4.0.0, < 5.0.0
โ”‚   โ”‚   โ””โ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 4.0.0, < 5.0.0
โ”‚   โ””โ”€โ”€ module.workload_identity
โ”‚       โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/kubernetes] ~> 2.13
โ”‚       โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 3.39.0, < 5.0.0
โ”‚       โ””โ”€โ”€ module.annotate-sa
โ”‚           โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 3.53.0, < 6.0.0
โ”‚           โ””โ”€โ”€ module.gcloud_kubectl
โ”‚               โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/null] >= 2.1.0
โ”‚               โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 3.53.0, < 6.0.0
โ”‚               โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/external] >= 2.2.2
โ”‚               โ””โ”€โ”€ provider[registry.terraform.io/hashicorp/random] >= 2.1.0
โ””โ”€โ”€ module.memorystore
    โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 4.38.0, < 5.0.0
    โ””โ”€โ”€ module.enable_apis
        โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 3.43.0, < 5.0.0
        โ””โ”€โ”€ provider[registry.terraform.io/hashicorp/google-beta] >= 3.43.0, < 5.0.0

Providers required by state:

    provider[registry.terraform.io/hashicorp/google]

    provider[registry.terraform.io/hashicorp/random]

Hello @apeabody, I've made the changes you requested, but I'm still encountering issues. Here's the output from terraform providers:

Providers required by configuration:
.
โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] 5.1.0
โ”œโ”€โ”€ module.app
โ”‚   โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/random] ~> 3.1
โ”‚   โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] 5.1.0
โ”‚   โ”œโ”€โ”€ module.bucket
โ”‚   โ”‚   โ””โ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 4.42.0, < 5.0.0
โ”‚   โ”œโ”€โ”€ module.secret-manager
โ”‚   โ”‚   โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google-beta] >= 4.0.0, < 5.0.0
โ”‚   โ”‚   โ””โ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 4.0.0, < 5.0.0
โ”‚   โ””โ”€โ”€ module.workload_identity
โ”‚       โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/kubernetes] ~> 2.13
โ”‚       โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 3.39.0, < 5.0.0
โ”‚       โ””โ”€โ”€ module.annotate-sa
โ”‚           โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 3.53.0, < 6.0.0
โ”‚           โ””โ”€โ”€ module.gcloud_kubectl
โ”‚               โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/null] >= 2.1.0
โ”‚               โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 3.53.0, < 6.0.0
โ”‚               โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/external] >= 2.2.2
โ”‚               โ””โ”€โ”€ provider[registry.terraform.io/hashicorp/random] >= 2.1.0
โ””โ”€โ”€ module.memorystore
    โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 4.38.0, < 5.0.0
    โ””โ”€โ”€ module.enable_apis
        โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 3.43.0, < 5.0.0
        โ””โ”€โ”€ provider[registry.terraform.io/hashicorp/google-beta] >= 3.43.0, < 5.0.0

Providers required by state:

    provider[registry.terraform.io/hashicorp/google]

    provider[registry.terraform.io/hashicorp/random]

Hi @fveas - This terraform-google-gcloud (gcloud_kubectl) module appears fine:

module.gcloud_kubectl
โ”‚               โ”œโ”€โ”€ provider[registry.terraform.io/hashicorp/google] >= 3.53.0, < 6.0.0

You will need updates for the other modules that include a < 5.0.0 constraint:

  • module.bucket
  • module.secret-manager
  • module.memorystore
  • module.workload_identity

Cheers

fveas commented

Hello @apeabody! Based on your experience, is there a way to resolve this locally, or do we need to wait for the repositories of those modules to be updated?

Hello @apeabody! Based on your experience, is there a way to resolve this locally, or do we need to wait for the repositories of those modules to be updated?

Hi @fveas - While you could try to fork the modules, TPG v5.0 included breaking changes. So at least a few modules will likely require changes for compatibility beyond just lifting the version constraint. I would check the repository in question, as most should have PRs in progress.