Closed snemetz closed 3 years ago
Im having the same issue trying to use the helm provider:
terraform {
required_providers {
helm = {
source = "hashicorp/helm"
version = "1.3.2"
}
}
}
provider "helm" {
kubernetes {
host = local.kube_host
cluster_ca_certificate = local.kube_cluster_ca_certificate_decoded
token = local.kube_token
load_config_file = false
}
}
`Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically use this backend unless the backend configuration changes.
Initializing provider plugins...
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/helm: no available releases match the given constraints 1.3.2 `
Thank you for the report! Short of more information to help replicate this issue, I've tagged this as a registry issue as perhaps the concern may lie there.
@crosbymichael1 -- it looks like your message cut of at the error message, so I'm not sure you have the same error here (the timeout).
@pselle I figured out what was going on
so I did a tg apply in one of the helm folders and got this error, which I thought was pretty weird because there is 100% a
helm provider version > 1.3 Initializing provider plugins...
After changing the version a bunch of times I found out that since I already had a different version of the binary in my tf plugins folder, that instead of downloading the new version, terraform just checked locally to see what I had installed, and since only 10.5 is there, well that is the only version I'd be allowed to use /Users/michael.crosby/.terraform.d/plugins/registry.terraform.io/hashicorp/helm/10.5 So I just deleted my local helm provider folder and then did a tg apply and it downloaded the version I specified and it worked fine then
Thanks for the additional information @crosbymichael1! I've re-added the new
label here because that gives more information that might help someone create a reproduction case for this particular angle of the issue (which could be separate from the original post, unsure, but what you've described does seem problematic, and tricky to detangle!)
@snemetz Try to delete your local aws file in the terraform plugins folder and then rerun terraform init and see if it resolves your issue:
rm -rf ~/.terraform.d/plugins/registry.terraform.io/hashicorp/aws
If your changing aws provider version I have a feeling if terraform see you already have a provider installed locally then its only checking for versions within your local folder and not out in the terraform registry.
That dir was empty. plugin-cache had a lot of versions. Remove all ` ls -lR total 8 -rw-r--r-- 1 stevennemetz staff 394 Nov 16 2018 checkpoint_signature drwxr-xr-x 3 stevennemetz staff 96 Jul 1 2019 plugin-cache drwxr-xr-x 3 stevennemetz staff 96 Jun 21 2019 plugins
./plugin-cache: total 0 drwxr-xr-x 2 stevennemetz staff 64 Oct 14 19:37 darwin_amd64
./plugin-cache/darwin_amd64:
./plugins: total 0 drwxr-xr-x 2 stevennemetz staff 64 Nov 5 2019 darwin_amd64
./plugins/darwin_amd64:`
Made no change. Same error. The error claims it is about downloading the versions file. Which should be before comparing with local files.
Debug log
`
2020/10/14 19:49:59 [INFO] Terraform version: 0.13.4
2020/10/14 19:49:59 [INFO] Go runtime version: go1.14.7
2020/10/14 19:49:59 [INFO] CLI args: []string{"/usr/local/bin/terraform13.4", "init"}
2020/10/14 19:49:59 [DEBUG] Attempting to open CLI config file: /Users/stevennemetz/.terraformrc
2020/10/14 19:49:59 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/10/14 19:49:59 [DEBUG] checking for credentials in "/Users/stevennemetz/.terraform.d/plugins"
2020/10/14 19:49:59 [DEBUG] checking for credentials in "/Users/stevennemetz/.terraform.d/plugins/darwin_amd64"
2020/10/14 19:49:59 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2020/10/14 19:49:59 [DEBUG] will search for provider plugins in /Users/stevennemetz/.terraform.d/plugins
2020/10/14 19:49:59 [TRACE] getproviders.SearchLocalDirectory: /Users/stevennemetz/.terraform.d/plugins is a symlink to /Users/stevennemetz/.terraform.d/plugins
2020/10/14 19:49:59 [DEBUG] ignoring non-existing provider search directory /Users/stevennemetz/Library/Application Support/io.terraform/plugins
2020/10/14 19:49:59 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2020/10/14 19:49:59 [INFO] CLI command args: []string{"init"}
2020/10/14 19:49:59 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/10/14 19:49:59 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/10/14 19:49:59 [DEBUG] New state was assigned lineage "d727669d-a920-07ec-4a64-bc51e80e8402"
2020/10/14 19:49:59 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
2020/10/14 19:49:59 [TRACE] Meta.Backend: instantiated backend of type
I have this issue as well, its been happening since I switched to using any 0.13.x version. To me it looks like the new provider resolution functionality doesn't function correctly with having set a plugin_cache_dir
setting.
This may actually be a case of https://github.com/hashicorp/terraform/issues/26223
Edit: Yep, I just fixed my case of this issue with mv ~/.terraform.d/plugins ~/.terraform.d/plugin-cache
and updating my .terraformrc
file from plugin_cache_dir = "$HOME/.terraform.d/plugins"
to plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"
problem solved instantly with all existing cached providers still recognised.
@snemetz Does this work for you?
I can't speak for snemetz but I appear to be seeing the same issue and I have no files in ~/.terraform.d/ besides a checkpoint_signature file
It looks like there are two different problems being reported in this issue: a registry timeout error for the AWS provider, and some provider installer-specific questions and issues. I'll see how many I can address!
Unfortunately I am not sure what caused this - I can't reproduce the issue now, and it's suspicious that curl
was working for you while init
was failing. I see that the same error messages were reported on two different days; do any of you still have this still problem today? I will check with our internal registry team and see if they have any ideas or information.
Terraform v0.13 will not query the registry for any provider it finds locally installed under ${CONFIG_DIR}.terraform/plugins
. Run terraform init -upgrade
to tell terraform to query the registry for provider versions and install any updates meeting your version constraints.
This mechanism is changing in v0.14 so there is a separate installation directory for locally installed (non-registry) providers; I'm afraid I will mangle the details but you can take a look at the (draft!!) of the v0.14 upgrade guide for a nice explanation of the new options: https://github.com/hashicorp/terraform/blob/master/website/upgrade-guides/0-14.html.markdown#the-local-provider-cache-directory
The TL;DR is that we recommend you use the filesystem_mirror configuration for local providers, but in v0.14 you will also be able to drop them in the following directory (relative to the terraform configuration files): terraform.d/plugins/
. It's important that we can designate directories that only terraform is allowed to write to, and will make sure the documentation is clear and add warnings where appropriate so it's clear to y'all.
Terraform expects to write to the plugin_cache_dir
and so it is invalid as a local mirror. We'll take a look at improving the documentation and printing a warning or error message if the provider installer finds problematic configuration like this. I'd like to keep further conversation about this specifically in #26223 , please.
Quick update: the registry team dug into their logs based on the timestamp on the original reported issue, and did not see anything suspicious, nor were there any reported outages with our various service providers. At this point I can't offer any explanation for the timeout beyond "vague unspecified network hiccups", but we'll definitely keep our eyes open and dig in if this happens again.
I am currently verifying and seeing the issue consistently.
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 2.70.0"...
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/aws:
could not query provider registry for registry.terraform.io/hashicorp/aws: the
request failed after 2 attempts, please try again later: Get
"https://registry.terraform.io/v1/providers/hashicorp/aws/versions": net/http:
request canceled while waiting for connection (Client.Timeout exceeded while
awaiting headers)
My versions.tf file for the module seeing the error is the following
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 2.70.0"
}
}
required_version = ">= 0.13"
}
This looks to be the same scenario as the original reported issue. We use no in-house providers, only the hashicorp AWS provider.
@C-Howard thanks! Is that happening right now ? I'll report this to the registry folks; it will help if you can share your TRACE logs
Yes it happens every time I run terraform init.
[terragrunt] [[redacted]/account] 2020/10/19 12:59:11 Running command: terraform --version
[terragrunt] 2020/10/19 12:59:15 Terraform version: 0.13.4
[terragrunt] 2020/10/19 12:59:15 Reading Terragrunt config file at [redacted]/account/terragrunt.hcl
[terragrunt] 2020/10/19 12:59:23 Running command: terraform init -backend-config=bucket=[redacted] -backend-config=dynamodb_table=[redacted] -backend-config=encrypt=true -backend-config=key=[redacted] -backend-config=region=us-east-1 -upgrade
2020/10/19 12:59:23 [INFO] Terraform version: 0.13.4
2020/10/19 12:59:23 [INFO] Go runtime version: go1.14.7
2020/10/19 12:59:23 [INFO] CLI args: []string{"/usr/local/bin/terraform", "init", "-backend-config=bucket=[redacted]", "-backend-config=dynamodb_table=[redacted]", "-backend-config=encrypt=true", "-backend-config=key=[redacted]/terraform.tfstate", "-backend-config=region=[redacted]", "-upgrade"}
2020/10/19 12:59:23 [DEBUG] Attempting to open CLI config file: /Users/[redacted]/.terraformrc
2020/10/19 12:59:23 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/10/19 12:59:23 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2020/10/19 12:59:23 [DEBUG] ignoring non-existing provider search directory /Users/[redacted]/.terraform.d/plugins
2020/10/19 12:59:23 [DEBUG] ignoring non-existing provider search directory /Users/[redacted]/Library/Application Support/io.terraform/plugins
2020/10/19 12:59:23 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
Initializing provider plugins...
2020/10/19 13:00:16 [TRACE] providercache.fillMetaCache: scanning directory .terraform/plugins
2020/10/19 13:00:16 [TRACE] getproviders.SearchLocalDirectory: .terraform/plugins is a symlink to .terraform/plugins
- Finding hashicorp/aws versions matching "~> 2.70.0"...
2020/10/19 13:00:16 [DEBUG] Service discovery for registry.terraform.io at https://registry.terraform.io/.well-known/terraform.json
2020/10/19 13:00:16 [TRACE] HTTP client GET request to https://registry.terraform.io/.well-known/terraform.json
2020/10/19 13:00:26 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions
2020/10/19 13:00:26 [TRACE] HTTP client GET request to https://registry.terraform.io/v1/providers/hashicorp/aws/versions
2020/10/19 13:00:36 [ERR] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions request failed: Get "https://registry.terraform.io/v1/providers/hashicorp/aws/versions": context deadline exceeded
2020/10/19 13:00:36 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions: retrying in 1s (1 left)
2020/10/19 13:00:37 [INFO] Previous request to the remote registry failed, attempting retry.
2020/10/19 13:00:37 [TRACE] HTTP client GET request to https://registry.terraform.io/v1/providers/hashicorp/aws/versions
2020/10/19 13:00:48 [ERR] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions request failed: Get "https://registry.terraform.io/v1/providers/hashicorp/aws/versions": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/aws:
could not query provider registry for registry.terraform.io/hashicorp/aws: the
request failed after 2 attempts, please try again later: Get
"https://registry.terraform.io/v1/providers/hashicorp/aws/versions": context
deadline exceeded (Client.Timeout exceeded while awaiting headers)
[terragrunt] 2020/10/19 13:00:48 Hit multiple errors:
exit status 1
Thanks, I appreciate the quick response - we'll dig into this on our end.
For anyone else reading this issue: Any new information is appreciated; anyone else experiencing this same issue please reply to the original comment with a 👍 (instead of adding comments that don't add information).
This does not seem to be a registry issue I can run curl with the same url successfully before and after the failed terraform run. I've done this on a number of days, always with the same results
Unless this can be figured out, 0.13 is a non-starter at my company
Not sure if this will help. But I removed ~/.terraform and the error changed. Now it displays
` Initializing provider plugins...
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/aws: could not connect to registry.terraform.io: Failed to request discovery document: Get "https://registry.terraform.io/.well-known/terraform.json": context deadline exceeded (Client.Timeout exceeded while awaiting headers) `
And via curl
curl https://registry.terraform.io/.well-known/terraform.json {"modules.v1":"/v1/modules/","providers.v1":"/v1/providers/"}
@snemetz Thanks for the additional info! We're still not able to find any indication of failing requests at our application or CDN layer. Could you try a more detailed cURL request? I don't have the exact headers Terraform sends off-hand, but something like:
curl https://registry.terraform.io/v1/providers/hashicorp/aws/versions \
--user-agent "Terraform/0.13.4" \
--header "X-Terraform-Version: 0.13.4" \
--compressed
I'll try to recreate the exact headers and options now and update you when I have a better arg set.
Also, where are you running these commands from? Are you on a home or office network, VPN, or if you're running this within a cloud provider, which provider and region?
I did verify that the cURL above is the request that Terraform is making:
Accept-Encoding: gzip
Connection: keep-alive
Host: registry.terraform.io
User-Agent: Terraform/0.13.4
X-Terraform-Version: 0.13.4
curl https://registry.terraform.io/v1/providers/hashicorp/aws/versions \
--user-agent "Terraform/0.13.4" \
--header "X-Terraform-Version: 0.13.4" \
--compressed
Works but terraform fails right afterward. In same shell
$ terraform13.4 init
Initializing the backend...
Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 3.0"...
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/aws:
could not query provider registry for registry.terraform.io/hashicorp/aws: the
request failed after 2 attempts, please try again later: Get
"https://registry.terraform.io/v1/providers/hashicorp/aws/versions": net/http:
request canceled while waiting for connection (Client.Timeout exceeded while
awaiting headers)
I'm running from home on a Mac.
Well this is Officially Weird!
We do update the go version and various dependencies with pretty much every release, and it is always possible that something in there is interacting with your local setup.
Is there anything customized or atypical about your home network? Do you have a proxy/VPN/firewall/custom dns settings? What version mac os are you on?
As before I am not the original poster but seeing the same issue and it looks to be a definite issue with delay due to DNS. Typically due to internal server connectivity we connect to DNS servers running out of the office and eventually fall back to a major provider like 1.1.1.1. I have not been using those dns servers outside of the office but using the fallback dns server. This results in roughly two dns server timeouts before a request succeeds.
So you can reproduce this issue on mac by having dns servers similar to the following
Unreachable server 1
Unreachable server 2
1.1.1.1
This will reliably cause the observed failure, and if you rearrange servers to something like
1.1.1.1
Unreachable server 1
Unreachable server 2
You will find your requests resolving again, which is probably why you are not seeing anything on the registry side. This suggests that any noticeable delay in dns resolution will cause the timeout to be hit.
@snemetz : @C-Howard 's last comment touches on what I was about to suggest - the old "It's always DNS" adage. Can you check your DNS configuration, or do you have a proxy?
I'm not as skilled at pouring through the changelogs, so I couldn't say just yet if this has to do with upgrading our golang version or some other dependency. Here are some maybe-related issues in the golang issue repository (emphasis on maybe). https://github.com/golang/go/issues/30702 https://github.com/golang/go/issues/23008 https://github.com/golang/go/issues/33006
I was also experiencing a similar issue with the cloudflare provider however we have managed to find a workaround that is showing promise(🤞). In our case, we upgraded the provider block to explicit 0.13 syntax and we hadn't yet ran an apply
against all configurations. Some of the confgurations would be pulling /-/cloudflare
as the /cloudflare/cloudflare
version and while the plan
would succeed without any changes, it wasn't until I forced a noop apply
against all configurations that this went away for us.
It's worth noting, I wasn't able to replicate the issue consistently though. We would see it periodically within our automated CI tests every few hours.
I am experiencing the same thing with Terraform 0.13.4
and 0.13.5
Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 3.12"...
2020/10/29 17:21:31 [DEBUG] Service discovery for registry.terraform.io at https://registry.terraform.io/.well-known/terraform.json
2020/10/29 17:21:31 [TRACE] HTTP client GET request to https://registry.terraform.io/.well-known/terraform.json
2020/10/29 17:21:41 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions
2020/10/29 17:21:41 [TRACE] HTTP client GET request to https://registry.terraform.io/v1/providers/hashicorp/aws/versions
2020/10/29 17:21:51 [ERR] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions request failed: Get "https://registry.terraform.io/v1/providers/hashicorp/aws/versions": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
2020/10/29 17:21:51 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions: retrying in 1s (1 left)
2020/10/29 17:21:52 [INFO] Previous request to the remote registry failed, attempting retry.
2020/10/29 17:21:52 [TRACE] HTTP client GET request to https://registry.terraform.io/v1/providers/hashicorp/aws/versions
2020/10/29 17:22:02 [ERR] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions request failed: Get "https://registry.terraform.io/v1/providers/hashicorp/aws/versions": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
My openssl is
$ openssl version
LibreSSL 2.6.5
Same result using openssl from brew
$ openssl version
OpenSSL 1.1.1h 22 Sep 2020
This does not happen when I am on a VPN located in AWS US-East-1, but not on my home ISP
You can override the default registry timeout (10 seconds) by setting TF_REGISTRY_CLIENT_TIMEOUT
to a number of seconds. You can also override the number of retries (default 1) by setting TF_REGISTRY_DISCOVERY_RETRY
. I'm not sure what the issue is here but I wonder if possibly bumping the timeout or something could help you mitigate this, or at least give us another data point.
Also if its possible, you may want to test the 0.14.0-beta2 release. Its built with a different Go version, which has a slightly different http.Client
implementation, so it may work differently.
I am also experiencing the same issue with Terraform 0.13
and Terraform 0.14
- Issue #26716.
I tried TF_REGISTRY_CLIENT_TIMEOUT
and TF_REGISTRY_DISCOVERY_RETRY
option but did not help.
I was finally able to reproduce the timeout issue and confirm the necessary fix: https://github.com/hashicorp/terraform/issues/26716#issuecomment-720549842
The TL;DR is that it is indeed the linked, upstream golang issue: binaries build with cgo
don't honor certain DNS settings on mac osx (more info in the linked comment above). Anyone with this problem and a golang development setup can test this out by building terraform with CGO_ENABLED=1
and trying again.
We are reaching out to our release team to modify terraform's build, and we'll also need to coordinate with our in-house provider development teams and communicate to third-party provider developers.
update: I closed the other issue, so to save y'all a click here's the same comment that I linked to above:
This is how I reproduced this on my local mac:
So, as we've suspected for awhile, the issues lies with golang/go#12524. We have reached out to our build team here at hashicorp about re-working our build to not use CGO.
One caveat: when we make this change, terraform will no longer have this issue, but it's entirely possible that folks will still see this same problem again because individual providers might be built with CGO (terraform init
would succeed but the actual plan/apply could fail with similar looking errors).
We will try and coordinate this build change with the provider developers we have direct relationships with, and communicate the necessity with all provider developers, but since we don't control their build processes we can't guarantee that all providers will make this same change. (this is not immediately relevant to the issue at hand, but I wanted to get the information out there in for future reference).
FWIW set homebrew to do CGO_ENABLED=1
https://github.com/Homebrew/homebrew-core/pull/65148
still occurs on Terraform v0.13.5
Still having this issue on v0.14.4
.
@0dragosh that was most likely the Fastly outage earlier today, see if your timing of it lines up with the incident on our status page or Fastly's.
@0dragosh that was most likely the Fastly outage earlier today, see if your timing of it lines up with the incident on our status page or Fastly's.
Timing coincides, thanks a lot for letting me know!
i have the issue in 0.14.4 with the kubectl provider. For some reason it tries to download it from hashicorp/kubectl instead of gavinbunney/kubectl
Could not retrieve the list of available versions for provider hashicorp/kubectl: provider registry registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/kubectl
@LBoraz Thank you for trying to connect to a relevant issue, but I think you've actually run into something else! We also have discussion forums that might help in the future.
What I suspect is happening for you is that you have a module that doesn't have the required_providers
block declared. Required providers/provider source is a per-module concept, so if you have a module that doesn't have it declared, Terraform is trying to find it in the default namespace (hashicorp
) and failing, thus your error.
The issue is still present
$ terraform version
Terraform v0.14.8
In my case only if I use $HOME/.terraform.d/plugins
as plugin_cache_dir
(as @techdragon suggested)
$ cat .terraformrc
# plugins path
# NOT working
plugin_cache_dir = "$HOME/.terraform.d/plugins"
# working
#plugin_cache_dir = "$HOME/.terraform.d/plugin-cache"
#plugin_cache_dir = "$HOME/.terraform.d/dummy"
this is my version.tf
used just to test terraform init
$ cat versions.tf
terraform {
# providers
required_providers {
vcd = {
source = "vmware/vcd"
version = "3.2.0"
}
}
# terraform version
required_version = ">= 0.14"
}
I still have this issue with 0.15.0. Any updates on this?
Same here. I have this issue with 0.15.0
Also having this issue
I'm still getting this issue too, MacOS 11.2.3
, Terraform verison 0.15.3
Downgraded to Terraform 0.12.31
, and now I can run terraform init
successfully!
This problem completely borks a fresh install of Terraform. I couldn't even get copy-pasted example code from the official docs running, because I could never get past terraform init
.
Seems like a cool tool, I hope this gets resolved soon! For the meantime I'm downgrading to the earlier version.
For those also seeking to downgrade Terraform Switcher has worked great.
It seems like this issue may have multiple underlying causes. For me, it seems to be a DNS issue.
I originally shared a log here about seeing this error in WSL2, but like others if I downgraded to terraform 0.13 things worked fine.
@apparentlymart replied there about differences between 0.13 and 0.14 but my issue went away for a couple days so I had nothing to go on. Since then, I've been 100% unable to run terraform init
unless I do the following:
If I modify my /etc/resolv.conf
to switch my DNS server to 8.8.8.8
(google dns) all terraform commands work as expected. If I switch it back to my standard/default nameserver that WSL assigns, I am completely unable to run any terraform commands that hit the network.
If I turn on TF_LOG I see things like:
2021-05-24T17:30:32.735-0500 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/random/versions
2021-05-24T17:30:42.737-0500 [ERROR] GET https://registry.terraform.io/v1/providers/hashicorp/random/versions request failed: Get "https://registry.terraform.io/v1/providers/hashicorp/random/versions": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
While I can have a second terminal window open looping on curl https://registry.terraform.io/v1/providers/hashicorp/kubernetes/versions
and I will get 0 failures.
@apparentlymart mentioned some possible TLS changes, but if this were just a TLS or SSL issue, I don't believe changing nameservers would reliably resolve the issue for me. Below are my results of dig ...
, one to my default nameserver, and another to google's dns server.
Editorial: I love terraform but this really needs to get resolved. Look at the number of issues if you search for the client timeout error message. I know those issues go back a few years and terraform has a lot of users but most of those issues have a good number of comments and other people commenting that they're having the same issue. There has to be some fundamental networking issue in terraform or the http client library it's using, otherwise simultaneous curl requests would be failing just like terraform.
I'm going to find some time to try and compile and run terraform from source, if one of the developers wants to add a mess of logging output or try anything to resolve this, send me a branch name and I'll happily test it out and help as much as I can.
dig registry.terraform.io '@172.25.80.1'
; <<>> DiG 9.16.1-Ubuntu <<>> registry.terraform.io @172.25.80.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65509
;; flags: qr rd ad; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;registry.terraform.io. IN A
;; ANSWER SECTION:
registry.terraform.io. 0 IN CNAME dualstack.q2.shared.global.fastly.net.
dualstack.q2.shared.global.fastly.net. 0 IN A 151.101.66.49
dualstack.q2.shared.global.fastly.net. 0 IN A 151.101.2.49
dualstack.q2.shared.global.fastly.net. 0 IN A 151.101.130.49
dualstack.q2.shared.global.fastly.net. 0 IN A 151.101.194.49
a.gtld-servers.net. 0 IN A 192.5.6.30
b.gtld-servers.net. 0 IN A 192.33.14.30
c.gtld-servers.net. 0 IN A 192.26.92.30
d.gtld-servers.net. 0 IN A 192.31.80.30
e.gtld-servers.net. 0 IN A 192.12.94.30
f.gtld-servers.net. 0 IN A 192.35.51.30
g.gtld-servers.net. 0 IN A 192.42.93.30
h.gtld-servers.net. 0 IN A 192.54.112.30
;; Query time: 40 msec
;; SERVER: 172.25.80.1#53(172.25.80.1)
;; WHEN: Mon May 24 17:16:08 CDT 2021
;; MSG SIZE rcvd: 484
dig registry.terraform.io '@8.8.8.8'
; <<>> DiG 9.16.1-Ubuntu <<>> registry.terraform.io @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15680
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;registry.terraform.io. IN A
;; ANSWER SECTION:
registry.terraform.io. 119 IN CNAME dualstack.q2.shared.global.fastly.net.
dualstack.q2.shared.global.fastly.net. 12 IN A 151.101.2.49
dualstack.q2.shared.global.fastly.net. 12 IN A 151.101.66.49
dualstack.q2.shared.global.fastly.net. 12 IN A 151.101.130.49
dualstack.q2.shared.global.fastly.net. 12 IN A 151.101.194.49
;; Query time: 20 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Mon May 24 17:16:02 CDT 2021
;; MSG SIZE rcvd: 165
I have the same issue above. Resolved it by updating my DNS settings.
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.
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
terraform init
works as intended I have the same issue above. Resolved it by updating my DNS settings.
what change you did ?
https://github.com/hashicorp/terraform/issues/26532#issuecomment-854888178 what change you did @brookemarshassoc
Hello,
Starting with Terraform v1.0.1 the MacOS binary is natively compiled, allowing Terraform to use the host resolver. This should avoid most issues with DNS configuration, many of which show up as timeouts like shown here.
Since this will likely resolve most of the issues represented by this thread I'm going to close it out. If anyone still encounters similar timeouts from the Terraform CLI on MacOS with v1.0.1 or newer, please file a new issue with the necessary information to reproduce it.
Thanks!
I'm still seeing this on WSL2 under windows. I'll get clean repro steps and create a new issue today or tomorrow.
Terraform Version
Terraform Configuration Files
Expected Behavior
Expected init to work
Actual Behavior
Initializing provider plugins...
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/aws: could not query provider registry for registry.terraform.io/hashicorp/aws: the request failed after 2 attempts, please try again later: Get "https://registry.terraform.io/v1/providers/hashicorp/aws/versions": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Steps to Reproduce
terraform init
Additional Context
I can use curl and access the url that terraform says it can't access with no issues I've tried multiple times over 2 days and issue doesn't change. Terraform always fails, curl always succeeds Had no issues with 0.12, but 0.13 has not worked yet Terraform section was the only change made going to 0.13 This is on Mac I also tried with only the posted terraform config and still get same issue