tfenv icon indicating copy to clipboard operation
tfenv copied to clipboard

Failed to query available provider packages

Open raszkiewicz opened this issue 3 years ago • 4 comments

I'm getting that error:

^^/P/G/Terraform >>> terraform init                                                                                                                                                                          

Initializing the backend...

Successfully configured the backend "gcs"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...
- Finding latest version of hashicorp/google...

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider
hashicorp/google: could not query provider registry for
registry.terraform.io/hashicorp/google: the request failed after 2 attempts,
please try again later: Get
"https://registry.terraform.io/v1/providers/hashicorp/google/versions":
context deadline exceeded (Client.Timeout exceeded while awaiting headers)

Regular terraform (v 0.14.2) installation throughout the homebrew works fine.

Any clue how to get terraform from tfenv to work?

raszkiewicz avatar Mar 18 '21 16:03 raszkiewicz

I have the same issue attempting to run terraform init with Google provider.

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/google...
╷
│ Error: Failed to query available provider packages
│ 
│ Could not retrieve the list of available versions for provider hashicorp/google: could not query provider registry for
│ registry.terraform.io/hashicorp/google: the request failed after 2 attempts, please try again later: Get
│ "https://registry.terraform.io/v1/providers/hashicorp/google/versions": context deadline exceeded

xcollantes avatar Jun 11 '21 06:06 xcollantes

I turned on my VPN and this resolved my issue. From what I read in other posts there is an issue with the DNS resolution with this version of Terraform.

Before VPN:

  • I could access curl https://registry.terraform.io/v1/providers/hashicorp/google/versions
  • Using the terraform init command returned the error:
    Initializing the backend...
    
    Initializing provider plugins...
    - Finding latest version of hashicorp/google...
    ╷
    │ Error: Failed to query available provider packages
    │ 
    │ Could not retrieve the list of available versions for provider hashicorp/google: could not query provider registry for
    │ registry.terraform.io/hashicorp/google: the request failed after 2 attempts, please try again later: Get
    │ "https://registry.terraform.io/v1/providers/hashicorp/google/versions": context deadline exceeded
    

After turning on VPN:

  • terraform init works as intended

xcollantes avatar Jun 12 '21 06:06 xcollantes

I'm having the same issue with versions 1.1.4 and 0.15.5 installed with tfenv. No problems are present using terraform 1.1.4 from the official Arch repositories so I guess this has to do with tfenv.

denisse-dev avatar Feb 02 '22 07:02 denisse-dev

This needs more diagnosis where the problem can be reproduced. I'm unable to reproduce it with the information available. The plugin retrieval is being done in Go by terraform, so the only impact tfenv can have that I can think of is modification of the shell environment used to execute terraform; although it does go out of its way not to do that. Im thinking for example could there be proxy settings involved or a netrc that are not getting passed through when using TFENV?

Zordrak avatar Jul 08 '22 10:07 Zordrak