tfutils / tfenv

Terraform version manager
MIT License
4.54k stars 455 forks source link

Failed to query available provider packages #252

Open raszkiewicz opened 3 years ago

raszkiewicz commented 3 years ago

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?

xcollantes commented 3 years ago

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 commented 3 years ago

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:

After turning on VPN:

denisse-dev commented 2 years ago

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.

Zordrak commented 2 years ago

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?