dnsimple / terraform-provider-dnsimple

Terraform DNSimple provider.
https://www.terraform.io/docs/providers/dnsimple/
Mozilla Public License 2.0
22 stars 20 forks source link

DNSimple module panic #57

Closed laurnts closed 1 year ago

laurnts commented 2 years ago

Panic Output

Screenshot 2022-09-13 at 04 49 27

Anyone knows what I am dealing with here? With same code, I can deploy to another domain (zone name) It appears to me that it might be a possibility that I added too many subdomain within certain period of time which I am getting blocked. Can someone confirm this?

nestorsalceda commented 2 years ago

Hey @laurnts,

I'm going to need more details for debugging this. My first thought is that something is happening between GRPC and plugin execution.

The stacktrace comes from: https://github.com/dnsimple/terraform-provider-dnsimple/blob/master/dnsimple/resource_dnsimple_zone_record.go#L162 And I would say, that data is nil.

In the case you get blocked for too much API requests, you will receive a 429 error code.

Let's dig deeper, I would like to know:

Thank you!

laurnts commented 2 years ago

@nestorsalceda This is the terraform and module version Terraform v1.2.9 on linux_amd64

In the case you get blocked for too much API requests, you will receive a 429 error code. This part I don't think so as I install the same terraform on another directory linked to another zone and it works just fine.

The dns records eventually get in the DNSimple (although it gets into an error), but the terraform process cannot continue

@nestorsalceda How to get the TF_LOG variable? Is it this?

Screenshot 2022-09-14 at 12 55 09

In general, this issue appear only to a particular zone_name which I am using to test (create alot of subdomains) multiple times in a certain period (I am not sure if its spammy, I created around 10 subdomain per day with terraform)

nestorsalceda commented 2 years ago

Thank you @laurnts

Let me check with the API folks to make sure that is the cause. Meanwhile we can continue with the TF_LOG issue.

I will need you to export a couple of environment variables and then run terraform apply again:

$ export TF_LOG=DEBUG
$ export TF_LOG_PATH=dnsimple.txt

$ terraform apply 

And then we will be able to see what's happening under the hoods :)

nestorsalceda commented 2 years ago

Other question I have for you @laurnts is if you are using the prefetch flag:

https://registry.terraform.io/providers/dnsimple/dnsimple/latest/docs#prefetch

Set to true to enable prefetching ZoneRecords when dealing with large configurations. This is useful when you are dealing with API rate limitations given your number of zones and zone records.

Thank you!

laurnts commented 2 years ago

@nestorsalceda Attached is the log file. Here I am only starting a simple webserver at Hetzner Cloud -> get the IP -> put it in DNSimple dnsimple.txt

I am currently running with the prefetch option (also the contain of this log)

nestorsalceda commented 2 years ago

I think I got it @laurnts

2022-09-14T21:38:39.870+0200 [INFO]  provider.terraform-provider-dnsimple_v0.13.0: 2022/09/14 21:38:39 [DEBUG] DNSimple Record create recordAttributes: dnsimple.ZoneRecordAttributes{ZoneID:"", Type:"A", Name:(*string)(0xc0005229f0), Content:"167.235.54.136", TTL:60, Priority:0, Regions:[]string(nil)}: timestamp=2022-09-14T21:38:39.870+0200
2022-09-14T21:38:40.261+0200 [ERROR] vertex "module.dnsimple_hcloud[0].dnsimple_zone_record.primary_host" error: Failed to create DNSimple Record: POST https://api.dnsimple.com/v2/121961/zones/dev.storeframe.io/records: 400 Validation failed

For some reason, we are receiving a validation error but is not getting propagated correctly.

So next steps:

I'm going to expedite this fix and I hope I have a fix in next couple of days.

Sounds good to you?

Thank you for your help!

laurnts commented 2 years ago

Hi @nestorsalceda

I think the validation 400 error is because another same zone name already exist (due to testing the panic error). So let me know if there is something else I have to look into, meanwhile I will be waiting for your response. Thank you

laurnts commented 2 years ago

Hi @nestorsalceda I see that you closed the issue, but I don't think the matter is resolved.

nestorsalceda commented 2 years ago

Hi @nestorsalceda I see that you closed the issue, but I don't think the matter is resolved.

Ouch, it was automatically closed when I merged the PR. Let me to reopen.

Tomorrow I will publish a new dnsimple-go client and I will upgrade the Terraform client with 2 patches:

Thank you for your patience :)

nestorsalceda commented 2 years ago

@laurnts I just published a new version 0.14.0 that will address this issue :)

Thank you for your patience!

laurnts commented 1 year ago

@nestorsalceda Ive tested it with DNSimple 0.14 but I still run into an error (same error).

Screenshot 2022-09-26 at 23 41 57
nestorsalceda commented 1 year ago

Hey @laurnts

I cut a new release 0.14.1 that will avoid the panic. I thought the error were in the error propagation but I found there were a panic when using the prefetching and the record cannot be found on the prefetched list.

I will be happy to hear you feedback.

Thanks for your patience.

laurnts commented 1 year ago

@nestorsalceda The new release fixes the issue with the panic, but I still run into an issue with prefetch. The subdomain get inserted into DNSimple but run into this error.

Screenshot 2022-09-28 at 05 39 51
laurnts commented 1 year ago

@nestorsalceda The new release fixes the issue with the panic, but I still run into an issue with prefetch. The subdomain get inserted into DNSimple but run into this error. Screenshot 2022-09-28 at 05 39 51

@nestorsalceda is there any updates for this issue?

nestorsalceda commented 1 year ago

Hey @laurnts

No at all. We fixed the panic but changing the behavior will require some extra prioritization because this may affect to other users.

My suggestion here will be to close this issue, related to the panic and open a new one as a feature request to allow modifying registries when the prefetch is enabled.