-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run "Terraform plan" getting error "Failed to request discovery document" #22774
Comments
Hi @jennihan! Based on the fact that you are using the remote backend with a hostname other than |
@jennihan was the issue has been resolved? |
I get this at random times also, I don't know if it is a coincidence, but I seem to get it more after an aborted terraform, when I have to manually release the lock... First time it fails with the above and succeeds there-on.
|
I am getting this a lot recently, seems like a very short timeout is set on this request. Right now in Singapore it's failing for me on ~50% of edit: terraform v0.12.24 |
I'm good if I don't use |
@alen-z can you please also note what terraform version you're using? |
Terraform v0.12.24 |
I'm getting this intermittently running Terraform v0.12.26 |
Same intermittent error with 0.12.28 from Sydney |
I Have the same problem: 2020/06/29 09:09:29 [TRACE] HTTP client GET request to https://registry.terraform.io/.well-known/terraform.json
|
Same problem here - London, UK |
Having the same problem lately. So annoying. My continuous integration is blocked. |
I started having this today. |
What's annoying about this issue is that it will probably never affect anyone with commit access. |
In my case, it occurred to be some weird issue with aws-vault and credentials. |
If you're a mac user you can try removing expired certificates from your keychain - https://discuss.hashicorp.com/t/error-when-running-terraform-init/3135/3 Make sure you go through both system & login certificates |
I also hit this issue in an alphine image. It failed due to
|
+1 Facing this issue every day in Terraform cloud apply |
+1 recently I started using terraform cloud as remote backend and boom hitting this issue on regular basis. Initializing the backend... |
It started being an issue for me on Saturday 11-Sep-2021. I am not using any backend, in fact I am running
The error I am getting is related to downloading a module:
The module in question is: module "label" {
source = "cloudposse/label/null"
version = "0.24.1"
# ...
} Occasionally it also fails on downloading provider information (even though I use lock files and local caching of providers):
I also noticed that I am in the UK on a 300Mbps fibre broadband from BT, so unless it's a BT issue (unlikely in this case), it must be something on HashiCorp end. I wonder if there's some API rate limiting or throttling in place, but I could not find anything to that effect in the documentation. I have also checked incident status on HashiCorp site, and all's green. |
I started a loop to curl terraform registry every second, and I started Terraform init for multiple modules in parallel. while true; do curl -v https://registry.terraform.io/.well-known/terraform.json ; sleep 1; done At some point both choked. Terraform bailed out pretty quickly, curl was stuck for longer but also gave up in the end. Here's the output from curl:
After that the curl loop carried on as normal. I am still not sure if it's a local issue, an issue with my provider (BT), an issue with Terraform registry, or an issue with HashiCorp CDN (Fastly). I'm not sure what else I can do to help diagnose this problem. |
OK, I think I have isolated and resolved the issue in my case. It's always DNS to blame in the end, right? I hardcoded CloudFlare DNS ( Looks like there must have been a rogue DNS server on BT side that was serving stale DNS records for I hope maybe this helps someone on this thread. |
It can also be that only the secure connection is allowed that is HTTPS whereas the backend is making HTTP calls. |
This issue is still actual on macos with the latest terraform release: ╷
│ Error: Error getting client
│
│ with provider["registry.terraform.io/hashicorp/tfe"],
│ on providers.tf line 7, in provider "tfe":
│ 7: provider "tfe" {}
│
│ Error getting client: Failed to request discovery document: Get "https://app.terraform.io/.well-known/terraform.json": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
╵
Releasing state lock. This may take a few moments...
λ terraform version
Terraform v1.4.0-alpha20221109 @Vivalldi mentioned certificates and here it's mentioned too as a bug of golang. But it's solved in golang/go@feb024f which is included in next releases: go1.19.3 go1.19.2 go1.19.1 go1.19 go1.19rc2 go1.19rc1 go1.19beta1 go1.18.8 go1.18.7 go1.18.6 go1.18.5 go1.18.4 go1.18.3 go1.18.2 go1.18.1 go1.18 go1.18rc1 go1.18beta2 go1.18beta1 terraform is using go1.18 since v1.4.0-alpha20221109 v1.3.5 v1.3.4 v1.3.3 v1.3.2 v1.3.1 v1.3.0 v1.3.0-rc1 v1.3.0-beta1 v1.3.0-alpha20220817 v1.3.0-alpha20220803 v1.3.0-alpha20220706 v1.3.0-alpha20220622 So since v1.3.0-alpha20220622 this is surely not a bug of golang. Maybe someone from the team could provide more info on this and when this annoying bug will be fixed. The only solution I can see now is move from terraform cloud to another backend |
@danieldreier any chance this will be fixed soon? Sorry for bothering, but there are no any comments from the maintainers for 2.5 years |
@iamolegga I’m no longer working at HashiCorp, so I can’t help get it prioritized |
@iamolegga is this happening with the |
@crw in my case it's cloud terraform {
cloud {
organization = "my-org"
workspaces {
name = "my-workspace"
}
}
required_providers { ... }
} |
Hi @iamolegga, do you have any firewall software on your system, and it is configured to allow this access? Also, could you please link us to the debug trace output? The following is excerpted from our new issue form, which explains how to prepare a debug log:
Thanks! cc: @annawinkler |
@iamolegga, as this is an issue with Terraform Cloud, you might also considered opening this through the official support channels. If you choose to do so, please email [email protected] or open a new request. |
👋 Just wanted to pop in to say that we're looking into this issue. Hopefully I'll have an update this week with more. ✨ |
We addressed two areas as part of this issue:
Closing out the issue now. If folks still see problems, let's open up a new issue. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Terraform Version
Terraform Configuration Files
Debug Output
Crash Output
Expected Behavior
display plan
Actual Behavior
getting below error
Error configuring the backend "remote": Failed to request discovery document: Get https://terraform.abc.io/.well-known/terraform.json: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Please update the configuration in your Terraform files to fix this error
then run this command again.
Steps to Reproduce
terraform init
terraform plan
Additional Context
References
The text was updated successfully, but these errors were encountered: