Skip to content
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

New livedns record: context deadline exceeded #145

Open
dan-mcdonald opened this issue Jul 5, 2023 · 5 comments
Open

New livedns record: context deadline exceeded #145

dan-mcdonald opened this issue Jul 5, 2023 · 5 comments

Comments

@dan-mcdonald
Copy link

I'm trying to add a new A record to my Gandi LiveDNS with this provider.

resource "gandi_livedns_record" "agency" {
  name = "agency"
  ttl = 300
  type = "A"
  values = [aws_instance.agency.public_ip]
  zone = "▮▮▮▮▮.net"
}

But during apply I get this error (run with TF_LOG=INFO):

gandi_livedns_record.agency: Creating...
2023-07-05T10:44:10.239-0500 [INFO]  Starting apply for gandi_livedns_record.agency
2023-07-05T10:44:18.053-0500 [ERROR] vertex "gandi_livedns_record.agency" error: Fail to do the request (error 'Get "https://api.gandi.net/v5/livedns/domains/▮▮▮▮▮.net/records/agency/A": context deadline exceeded (Client.Timeout exceeded while awaiting headers)')
╷
│ Error: Fail to do the request (error 'Get "https://api.gandi.net/v5/livedns/domains/▮▮▮▮▮.net/records/agency/A": context deadline exceeded (Client.Timeout exceeded while awaiting headers)')
│
│   with gandi_livedns_record.agency,
│   on main.tf line 36, in resource "gandi_livedns_record" "agency":
│   36: resource "gandi_livedns_record" "agency" {
│

I think the request will work if it is given more time. My internet connection is not the fastest. Is there a configuration knob to increase the timeout? Currently it fails for me after only 10/15 seconds.

Other details:

> terraform version 
2023-07-05T10:48:33.039-0500 [INFO]  Terraform version: 1.5.2
2023-07-05T10:48:33.041-0500 [INFO]  Go runtime version: go1.20
2023-07-05T10:48:33.042-0500 [INFO]  CLI args: []string{"C:\\Users\\danie_10m7rom\\dev\\bin\\terraform.exe", "version"}
2023-07-05T10:48:33.062-0500 [INFO]  CLI command args: []string{"version"}
Terraform v1.5.2
on windows_amd64
+ provider registry.terraform.io/go-gandi/gandi v2.2.3
+ provider registry.terraform.io/hashicorp/aws v5.6.1

Any help you provide is appreciated. I know I'm not entitled to any free help.

@benbouillet
Copy link

I'm getting this issue intermittently, did you find a workaround ? @dan-mcdonald

@marcaurele
Copy link

We do have the same problem and it appears quite often on our plan execution, which is very problematic for us. I'm surprised to read from the API documentation1:

Rate limit

Gandi's API is rate limited; you can perform a maximum of 1000 requests per minute from the same IP address.

which we are definitively not hitting.

Moreover, looking at the code / reference there is a (strange) custom default key to configure the timeout for the nemserver records: https://registry.terraform.io/providers/go-gandi/gandi/latest/docs/resources/nameservers#default

Adding this block in the resource did not even fix the problem:

resource "gandi_nameservers" "example" {
  ...
  timeouts {
    default = 60
  }
}

Note

The provider code has some code for a default timeout, which is not exposed in the provider configuration, with a default value of 5 seconds.

🤷

Footnotes

  1. https://api.gandi.net/docs/reference/#RESTful-interface

@insertjokehere
Copy link
Contributor

I'm running into this essentially every time I run terraform plan, which is very frustrating.

It seems like the plugin passes config back to the go-gandi library here:

func getGandiClients(d *schema.ResourceData) (interface{}, error) {
config := config.Config{
APIURL: d.Get("url").(string),
APIKey: d.Get("key").(string),
PersonalAccessToken: d.Get("personal_access_token").(string),
SharingID: d.Get("sharing_id").(string),
DryRun: d.Get("dry_run").(bool),
Debug: logging.IsDebugOrHigher(),
}
liveDNS := gandi.NewLiveDNSClient(config)
email := gandi.NewEmailClient(config)
domainClient := gandi.NewDomainClient(config)
simpleHostingClient := gandi.NewSimpleHostingClient(config)
certificateClient := gandi.NewCertificateClient(config)
return &clients{
Domain: domainClient,
Email: email,
LiveDNS: liveDNS,
SimpleHosting: simpleHostingClient,
Certificate: certificateClient,
}, nil
}

The library exposes a timeout option (defaulting to 5 seconds) which the terraform provider doesn't provide a way to override:

https://github.com/go-gandi/go-gandi/blob/29df69368462adc734b4ffc650d33918f11d25f4/config/config.go#L6-L31

Ideally Gandi would fix their API so it wasn't so slow, but as an interim solution it'd be nice to be able to override the timeout config

insertjokehere added a commit to insertjokehere/terraform-provider-gandi that referenced this issue Jun 8, 2024
@marcaurele
Copy link

We solved it the hard way... moving away from Gandi.

@reedog117
Copy link

reedog117 commented Nov 28, 2024

I am still getting this error just trying to do a simple terraform import. Running with TF_LOG=DEBUG and running the resultant curl command myself works with no issues. This has to be a bug somewhere in the provider but I can't pinpoint it. What's even more puzzling is that running the curl command myself has a response in much less than 5s (closer to 1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants