Giter Club home page Giter Club logo

terraform-provider-hetznerdns's Introduction

Terraform Provider for Hetzner DNS

CI Build GitHub release (latest by date) GitHub

Read about what I learnt while implementing this Terraform Provider.

This provider is on published on the Terraform registry.

You can find resources and data sources documentation there or here.

Requirements

  • Terraform > v1.0
  • Go 1.16 (to build the provider plugin)

Installing and Using this Plugin

You most likely want to download the provider from Terraform Registry. If you want or need to install the provider locally, take a look at INSTALL.

Using Provider from Terraform Registry (TF >= 1.0)

This provider is published and available there. If you want to use it, just add the following to your terraform.tf:

terraform {
  required_providers {
    hetznerdns = {
      source = "timohirt/hetznerdns"
      version = "2.1.0"
    }
  }
  required_version = ">= 1.0"
}

Then run terraform init to download the provider.

Authentication

Once installed you have three options to provide the required API token that is used to authenticate at the Hetzner DNS API.

Enter API Token when needed

You can enter it every time you run terraform.

Configure the Provider to take the API Token from a Variable

Add the following to your terraform.tf:

variable "hetznerdns_token" {}

provider "hetznerdns" {
  apitoken = var.hetznerdns_token
}

Now, assign your API token to hetznerdns_token in terraform.tfvars:

hetznerdns_token = "kkd993i3kkmm4m4m4"

You don't have to enter the API token anymore.

Inject the API Token via the Environment

Assign the API token to HETZNER_DNS_API_TOKEN env variable.

export HETZNER_DNS_API_TOKEN=<your api token>

The provider uses this token and you don't have to enter it anymore.

Example Usage

# Specify a zone for a domain (example.com)
resource "hetznerdns_zone" "example_com" {
  name = "example.com"
  ttl  = 60
}

# Handle root (example.com)
resource "hetznerdns_record" "example_com_root" {
  zone_id = hetznerdns_zone.example_com.id
  name    = "@"
  value   = hcloud_server.server_name.ipv4_address
  type    = "A"
  # You only need to set a TTL if it's different from the zone's TTL above
  ttl     = 300
}

# Handle wildcard subdomain (*.example.com)
resource "hetznerdns_record" "all_example_com" {
  zone_id = hetznerdns_zone.example_com.id
  name    = "*"
  value   = hcloud_server.server_name.ipv4_address
  type    = "A"
}

# Handle specific subdomain (books.example.com)
resource "hetznerdns_record" "books_example_com" {
  zone_id = hetznerdns_zone.example_com.id
  name    = "books"
  value   = hcloud_server.server_name.ipv4_address
  type    = "A"
}

# Handle email (MX record with priority 10)
resource "hetznerdns_record" "example_com_email" {
  zone_id = hetznerdns_zone.example_com.id
  name    = "@"
  value   = "10 mail.example.com"
  type    = "MX"
}

# SPF record
resource "hetznerdns_record" "example_com_spf" {
  zone_id = hetznerdns_zone.example_com.id
  name    = "@"
  # The entire value needs to be enclosed in quotes in the zone file, if it contains a space or a quote. For Terraform, you need to escape these "inner" quotes:
  value   = "\"v=spf1 ip4:1.2.3.4 -all\""
  # Or let `jsonencode()` take care of the escaping:
  value   = jsonencode("v=spf1 ip4:1.2.3.4 -all")
  type    = "TXT"
}

terraform-provider-hetznerdns's People

Contributors

90er avatar felixhummel avatar frisch12 avatar l-with avatar lazyfrosch avatar qbart avatar thomaslandauer avatar timohirt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-hetznerdns's Issues

Convert list of values to multiple records

I would love to have the abillity to use lists to generate (multiple) records like so for example:

resource "hetznerdns_record" "domain_com-NS" {
  zone_id = hetznerdns_zone.domain_com.id
  name = "@"
  type = "NS"
  value = [ "helium.ns.hetzner.de.", "hydrogen.ns.hetzner.com.", "oxygen.ns.hetzner.com." ]

Fake or real ALIAS record support

powerdns supports a record type called ALIAS where you can add "CNAME"-like records for the root of a domain.

``hcl
resource "powerdns_record" "example_at" {
zone = "example.at."
name = "example.at."
type = "ALIAS"
ttl = 300
records = ["www.example.at."]
}
resource "powerdns_record" "www_example_at" {
zone = "example.at."
name = "www.example.at."
type = "CNAME"
ttl = 300
records = ["host10.example.net."]
}


real alias support must be implemented by hetzner, so the alias will auto looked up on query but this provider could allow a fake alias record, where the correct ip will be queried on terraform run and then a regular `A` record will be created.

- https://doc.powerdns.com/authoritative/guides/alias.html
- https://kb.isc.org/docs/aa-01640
- https://support.dnsimple.com/articles/alias-record/



Example for handling SRV records

Hello,

I have already checked the documentation and I was wondering if someone already had sucess to create a SRV record and could share any example.

Further it would be great then if it would be added to the Examples block in the README.

Long record values are corrupted during create/update (e.g. SPF)

When a DNS record with a long value is created or updated, quotes are inserted in the value. I used the request below to create a record.

curl -X "POST" "https://dns.hetzner.com/api/v1/records" \
     -H 'Content-Type: application/json' \
     -H "Auth-API-Token: $HETZNER_DNS_API_TOKEN" \
     -d '{
  "value": "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhTo5UKCr5cHhmne2ZZX5swOlNP794OWVxmhPt0hdsMaYQ9d1uJ86u4qdwuu6M7DCV/pRg4+XdSAeSGOm0O6k+oBSrkzk+ijGuCjDSKNrCsDEJwyVBkbnat2mDtKednRWolIZmUP1Rs9pNOKcq8FJI52Ewc5imeX1T0agawtRB6Q0RoJOoEo4Y0fNeDOFTcn9YE7qgl2dKjo7ng8Ty/na8IBMqIjbzVaKpKQnIKfCwopO4cF7fzDHuqxSCxD3CAidgUbdHarwgC5M7d43GnWmGwgA5PhnE0iUNASbbfStY4PSHXeq3+FO2euC348/Vk6WOE9tFTEFiF/oMq5qgm5yEwIDAQAB",
  "ttl": 3600,
  "type": "TXT",
  "name": "dkim_2",
  "zone_id": "rMu2waTJP77777777777"
}'

The value is one string. Now, let's take a look at the response.

{
  "record": {
    "id": "c03bdbf918bc9984090242a9da1d240e",
    "type": "TXT",
    "name": "dkim_2",
    "value": "\"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhTo5UKCr5cHhmne2ZZX5swOlNP794OWVxmhPt0hdsMaYQ9d1uJ86u4qdwuu6M7DCV/pRg4+XdSAeSGOm0O6k+oBSrkzk+ijGuCjDSKNrCsDEJwyVBkbnat2mDtKednRWolIZmUP1Rs9pNOKcq8FJI52Ewc5imeX1T0agawtRB6Q0RoJOoEo4Y0fNeDOFTcn9Y\" \"E7qgl2dKjo7ng8Ty/na8IBMqIjbzVaKpKQnIKfCwopO4cF7fzDHuqxSCxD3CAidgUbdHarwgC5M7d43GnWmGwgA5PhnE0iUNASbbfStY4PSHXeq3+FO2euC348/Vk6WOE9tFTEFiF/oMq5qgm5yEwIDAQAB\" ",
    "ttl": 3600,
    "zone_id": "rMu2waTJPbHr45psPMZxHV",
    "created": "2020-09-03 20:29:53.973 +0000 UTC",
    "modified": "2020-09-03 20:29:53.973 +0000 UTC"
  }
}

There are 4 additional quotes now. It seems that the value was split into two values and this resulted into an invalid DKIM record:

image

This has to be fixed by Hetzner as it happens in the API.

409 Conflict - Error when creating hetznerdns_records

I have a terraform resource which should create a dns-record entry for each server I created before:

resource "hetznerdns_record" "ipv4" {
    count = 2
    zone_id = var.dns_zone_id
    name = hcloud_server.rancher[count.index].name
    value = hcloud_server.rancher[count.index].ipv4_address
    type = "A"
    ttl= 60
}

When applying this resource, the following error occurs:

Terraform will perform the following actions:

  # hetznerdns_record.ipv4[0] will be created
  + resource "hetznerdns_record" "ipv4" {
      + id      = (known after apply)
      + name    = "rancher0"
      + ttl     = 60
      + type    = "A"
      + value   = "78.47.182.191"
      + zone_id = "tE8hyXXXXXXX"
    }

  # hetznerdns_record.ipv4[1] will be created
  + resource "hetznerdns_record" "ipv4" {
      + id      = (known after apply)
      + name    = "rancher1"
      + ttl     = 60
      + type    = "A"
      + value   = "116.203.123.223"
      + zone_id = "tE8hyXXXXXXX"
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Output:

hetznerdns_record.ipv4[0]: Creating...
hetznerdns_record.ipv4[1]: Creating...
hetznerdns_record.ipv4[1]: Creation complete after 1s [id=49c28c994e600ecec10e76493ea44727]

Error: Error creating DNS record rancher0: Error creating record rancher0: API returned HTTP 422 Unprocessable Entity error with message: '**409 Conflict:** '

  on dns.tf line 1, in resource "hetznerdns_record" "ipv4":
   1: resource "hetznerdns_record" "ipv4" { 

The error occurs, but the 2 records are created in Hetzner-dns:

Bildschirmfoto 2020-07-06 um 22 26 18

Do I make a mistake while creating these resources or is there a bug? How can this error be avoided?

Debug-Output at Loglevel DEBUG:

hetznerdns_record.ipv4[1]: Creating...
hetznerdns_record.ipv4[0]: Creating...
2020/07/06 22:33:21 [DEBUG] hetznerdns_record.ipv4[1]: applying the planned Create change
2020/07/06 22:33:21 [DEBUG] hetznerdns_record.ipv4[0]: applying the planned Create change
2020-07-06T22:33:21.762+0200 [DEBUG] plugin.terraform-provider-hetznerdns: 2020/07/06 22:33:21 [DEBUG] Updaing resource record
2020-07-06T22:33:21.762+0200 [DEBUG] plugin.terraform-provider-hetznerdns: 2020/07/06 22:33:21 [DEBUG] HTTP request to API POST https://dns.hetzner.com/api/v1/records
2020-07-06T22:33:21.762+0200 [DEBUG] plugin.terraform-provider-hetznerdns: 2020/07/06 22:33:21 [DEBUG] Updaing resource record
2020-07-06T22:33:21.762+0200 [DEBUG] plugin.terraform-provider-hetznerdns: 2020/07/06 22:33:21 [DEBUG] HTTP request to API POST https://dns.hetzner.com/api/v1/records
2020-07-06T22:33:22.253+0200 [DEBUG] plugin.terraform-provider-hetznerdns: 2020/07/06 22:33:22 [DEBUG] 422 Unprocessable Entity error response body: {"record":{"id":"","type":"","name":"","value":"","zone_id":"","created":"","modified":""},"error":{"message":"409 Conflict: ","code":422}}
2020-07-06T22:33:22.253+0200 [DEBUG] plugin.terraform-provider-hetznerdns: 2020/07/06 22:33:22 [ERROR] Error Creating DNs record rancher1: Error creating record rancher1: API returned HTTP 422 Unprocessable Entity error with message: '409 Conflict: '
2020/07/06 22:33:22 [DEBUG] hetznerdns_record.ipv4[1]: apply errored, but we're indicating that via the Error pointer rather than returning it: Error creating DNS record rancher1: Error creating record rancher1: API returned HTTP 422 Unprocessable Entity error with message: '409 Conflict: '
2020/07/06 22:33:22 [ERROR] <root>: eval: *terraform.EvalApplyPost, err: Error creating DNS record rancher1: Error creating record rancher1: API returned HTTP 422 Unprocessable Entity error with message: '409 Conflict: '
2020/07/06 22:33:22 [ERROR] <root>: eval: *terraform.EvalSequence, err: Error creating DNS record rancher1: Error creating record rancher1: API returned HTTP 422 Unprocessable Entity error with message: '409 Conflict: '
2020-07-06T22:33:22.839+0200 [DEBUG] plugin.terraform-provider-hetznerdns: 2020/07/06 22:33:22 [DEBUG] Reading resource record
2020-07-06T22:33:22.839+0200 [DEBUG] plugin.terraform-provider-hetznerdns: 2020/07/06 22:33:22 [DEBUG] HTTP request to API GET https://dns.hetzner.com/api/v1/records/97b81d00629ef17ab64f1d7542ff8d1d
hetznerdns_record.ipv4[0]: Creation complete after 1s [id=97b81d00629ef17ab64f1d7542ff8d1d]

Error: Error creating DNS record rancher1: Error creating record rancher1: API returned HTTP 422 Unprocessable Entity error with message: '409 Conflict: '

  on dns.tf line 1, in resource "hetznerdns_record" "ipv4":
   1: resource "hetznerdns_record" "ipv4" {


2020-07-06T22:33:22.938+0200 [DEBUG] plugin: plugin process exited: path=/Users/ronny/dev/terraform/rancher/terraform/.terraform/plugins/darwin_amd64/terraform-provider-hetznerdns pid=26105

Add more examples to the doc

a out of the box working example with everything needed to create a zone, a record and assign it to a host would be awesome (see #14 xD)

Environment variable is not recognized

Hi,

I'm trying to set some dns records, which works well when being asked for my API Token by terraform, but I always get a 401 error when using the HETZNER_DNS_API_TOKEN environment variable.

module.worker.hetznerdns_record.dns-a[2]: Creating...
module.worker.hetznerdns_record.dns-a[0]: Creating...

Error: Error creating DNS record api.os: Error creating Record. HTTP status 401 unhandled

  on dns.tf line 91, in resource "hetznerdns_record" "dns_a_api":
  91: resource "hetznerdns_record" "dns_a_api" {



Error: Error creating DNS record api-int.os: Error creating Record. HTTP status 401 unhandled

  on dns.tf line 101, in resource "hetznerdns_record" "dns_a_api_int":
 101: resource "hetznerdns_record" "dns_a_api_int" {



Error: Error creating DNS record apps.os: Error creating Record. HTTP status 401 unhandled

  on dns.tf line 111, in resource "hetznerdns_record" "dns_a_apps":
 111: resource "hetznerdns_record" "dns_a_apps" {

Any idea why the error occurs? How am I supposed to debug the problem?

Thanks,
Tim

HTTP 422 - Unprocessable entity

When trying to set dns records, the DNS API always returns HTTP 422 errors.

Error: Error creating DNS record apps.os: Error creating Record. HTTP status 422 unhandled

  on dns.tf line 31, in resource "hetznerdns_record" "dns_a_apps":
  31: resource "hetznerdns_record" "dns_a_apps" {



Error: Error creating DNS record *.apps.os: Error creating Record. HTTP status 422 unhandled

  on dns.tf line 41, in resource "hetznerdns_record" "dns_a_apps_wc":
  41: resource "hetznerdns_record" "dns_a_apps_wc" {



Error: Error creating DNS record etcd-0.os: Error creating Record. HTTP status 422 unhandled

  on dns.tf line 51, in resource "hetznerdns_record" "dns_a_etcd":
  51: resource "hetznerdns_record" "dns_a_etcd" {

This is an excerpt from my resource definitions:

resource "hetznerdns_record" "dns_a_apps" {
  zone_id = var.dns_zone_id
  name    = "apps.os"
  value   = var.ip_loadbalancer_apps == null ? hcloud_floating_ip.floating_ip.ip_address : var.ip_loadbalancer_apps
  type    = "A"
  ttl     = 1
}

resource "hetznerdns_record" "dns_a_apps_wc" {
  zone_id = var.dns_zone_id
  name    = "*.apps.os"
  value   = var.ip_loadbalancer_apps == null ? hcloud_floating_ip.floating_ip.ip_address : var.ip_loadbalancer_apps
  type    = "A"
  ttl     = 1
}

resource "hetznerdns_record" "dns_a_etcd" {
  zone_id = var.dns_zone_id
  name    = "etcd-${count.index}.os"
  value   = module.master.ipv4_addresses[count.index]
  type    = "A"
  ttl     = 1

  count = length(module.master.ipv4_addresses)
}

Surprisingly all the dns records have been set though and are shown in the dns console.

A second run unfortunately adds all of the records again, so they are listed twice in the end. It seems to me that the dns provider is not idempotent yet?

Suggestion: Provide constants for Hetzner nameservers

I just created this in my .ts file:

locals {
    hetzner_ns1 = "helium.ns.hetzner.de."
    hetzner_ns2 = "hydrogen.ns.hetzner.com."
    hetzner_ns3 = "oxygen.ns.hetzner.com."
}

And besides asking myself if this is really the "correct" way to do it ;-) - The more important question is: I guess everybody doing DNS with Hetzner will need those nameservers, so is there a way you could distribute those values right inside the provider?

Suggestion: Support IDNs

When the domain name contains an umlaut, I'm getting this error:

Error: Error creating zone. API returned HTTP 422 Unprocessable Entity error with message: '422 Unprocessable Entity: invalid invalid character for domain name'

So I'm suggesting that you're including the conversion to punycode in the provider - especially since (after a quick search) I couldn't find a conversion function in Terraform, so right now the conversion has to be done outside of Terraform (i.e. manually).

When TXT record contains string ; API will create and return escaped string with \"

image

resource "hetznerdns_record" "txtdkim" {
    zone_id = hetznerdns_zone.zone1.id
    name    = "google._domainkey"
    value   = "anything;with;param"
    type    = "TXT"
    ttl     = 3600
}

terraform plan will produce neverending update

  # module.e_records.hetznerdns_record.txtdkim[0] will be updated in-place
  ~ resource "hetznerdns_record" "txtdkim" {
        id      = "xxx"
        name    = "google._domainkey"
        ttl     = 3600
        type    = "TXT"
      ~ value   = "\"v=DKIM1;k=rsa;p=OLOL\"" -> "v=DKIM1;k=rsa;p=OLOL"
        zone_id = "xxx"
    }

btw thank you for your work👌 , I wrote article here
https://www.exploit.cz/hetzner-dns-via-terraform/

Issues working with wildcard DNS

I recently wanted to add a new node to my Hetzner cluster. I didn't execute terraform for a while no so I'm still searching if something changed at the Hetzner DNS API. Though, I though I post the issue here.

The first thing that raise my attention was that terraform plan did not correctly refresh the state from the wildcard DNS entry. It was marked "needs creation" while the record is actually there and works (confirmed via Hetzner DNS console). When applying the changes terraform ends with the following error while creating the wildcard entry (TF_LOG=debug was set)

hetznerdns_record.ingress-wildcard: Creating...
2021-11-04T09:32:19.533+0100 [INFO]  Starting apply for hetznerdns_record.ingress-wildcard
2021-11-04T09:32:19.534+0100 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-11-04T09:32:19.536+0100 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hetznercloud/hcloud/1.26.2/linux_amd64/terraform-provider-hcloud_v1.26.2 pid=637694
2021-11-04T09:32:19.536+0100 [DEBUG] provider: plugin exited
2021-11-04T09:32:19.536+0100 [DEBUG] hetznerdns_record.ingress-wildcard: applying the planned Create change
2021-11-04T09:32:19.537+0100 [DEBUG] provider.terraform-provider-hetznerdns_v1.1.1: 2021/11/04 09:32:19 [DEBUG] Updating resource record
2021-11-04T09:32:19.537+0100 [DEBUG] provider.terraform-provider-hetznerdns_v1.1.1: 2021/11/04 09:32:19 [DEBUG] HTTP request to API POST https://dns.hetzner.com/api/v1/records
2021-11-04T09:32:19.725+0100 [DEBUG] provider.terraform-provider-hetznerdns_v1.1.1: 2021/11/04 09:32:19 [ERROR] Error creating DNS record *: Error creating record *: API returned HTTP 422 Unprocessable Entity error with message: '422 Unprocessable Entity: taken  *'

The resource block looks like this:

resource "hetznerdns_record" "ingress-wildcard" {
  zone_id = data.hetznerdns_zone.rootzone.id
  name    = "*"
  type    = "CNAME"
  value   = "ingress.cluster"
  ttl     = var.dns_ttl
}

That block hasn't change for a while now so I'm 100% sure it worked before.
Please tell me if I can help further debugging this!

Thanks for this awesome provider!

dot or no dot

for everyone configures bind dns server it's quite common to add a dot at the end of a domain in the config. some abstractions or gui interfaces try to help you and don't require you to add a dot on the end.

but how is it handled here? zone domain with dot or without dot? cname with dot or without? should be somehow handled in the provider docs and maybe add some warning messages if a cname record is created without a dot at the end.

add data source hetznerdns_records

add data source hetznerdns_records

this will make it possible to use the terraform provider also in projects that need the information of dns records

terraform apply randomly gets stuck with "Still creating"

When running terraform apply everything hetznernds related randomly gets stuck with the status "Still Creating..." and stays in that state until it aborts/runs in a timeout.
It's not clear for me when exactly it happens but:

  • Sometimes right at the start
  • Sometimes somewhere during the apply run
  • Rarely the issue doesn't occur at all

I manage a couple of domains with terraform and it's almost impossible for me to roll out changes as the terraform apply fails almost every time like that.

My versions:

Terraform v1.3.6
on windows_amd64
+ provider registry.terraform.io/hetznercloud/hcloud v1.36.1
+ provider registry.terraform.io/timohirt/hetznerdns v2.2.0

Long TXT value is getting recreated upon `terraform apply`

I have this DKIM record in my terraform.tf:

value  = "v=DKIM1;h=sha256;k=rsa;s=email;p=MIIB...QAB""

Now, upon each terraform apply, I'm getting:

# hetznerdns_record.... will be updated in-place
~ resource "hetznerdns_record" "..." {
      id      = "..."
      name    = "default._domainkey.mail"
    ~ value   = "\"v=DKIM1;h=sha256;k=rsa;s=email;p=MIIB...rui\" \"6AD...QAB\" " -> "v=DKIM1;h=sha256;k=rsa;s=email;p=MIIB...QAB\""
      # (3 unchanged attributes hidden)
  }

So (together with the information from #13) this looks like the API is automatically splitting the long string. But then, this provider thinks it's different from my long string, and tries to recreate it.
Unfortunately, I didn't quite get the bottom line of #13 - is it to split the value string manually in 2 parts?

Make record ttl optional

A record's ttl is optional in Hetzner's DNS API and it should also be optional in this provider. It'll default to the zone's ttl which always set.

How to increase timeouts & retries?

Looks like hetzner is very slow at provisioning dns records.

My script fails on apparent timeouts - after 11 tries.

is there a parameter to configure it?

How to handle SOA entries?

Hi, I'm curious whether this is possible or intended with this provider as it's my understanding that SOA is a dynamic entry that is modified every time the zonefile is changed.

Plugin crashes accessing a not existing zone via datasource

terraform versions tried:

  • 0.11.14
  • 0.12.29
  • 0.13.1

  • running on windows
  • with strict firewall (also local connections and outbound connections have to be allowed(allowed for terraform and the plugins))
  • connection through a http proxy

no problem with hcloud plugin but hetznerdns is always crashing. also tried lower versions of this plugin but also crashed all the time (there where different error messages which i haven't written down). can provide the crash log if required (left them off this ticket because it would need redacting). also removed some paths from the crashoutput below.

0.11.14:

data.hetznerdns_zone.dns_zone: Refreshing state...

Error: Error refreshing state: 1 error occurred:
        * data.hetznerdns_zone.dns_zone: 1 error occurred:
        * data.hetznerdns_zone.dns_zone: data.hetznerdns_zone.dns_zone: unexpected EOF

panic: runtime error: invalid memory address or nil pointer dereference
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: [signal 0xc0000005 code=0x0 addr=0
x18 pc=0xd4ef12]
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: goroutine 70 [running]:
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/timohirt/terraform-prov
ider-hetznerdns/hetznerdns.dataSourceHetznerDNSZoneRead(0xc00079eb60, 0xf444e0, 0xc0006487a0, 0xc00079eb60, 0x0)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/work/terraform-prov
ider-hetznerdns/terraform-provider-hetznerdns/hetznerdns/data_source_zone.go:40 +0x162
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plu
gin-sdk/helper/schema.(*Resource).ReadDataApply(0xc000458e10, 0xc000796da0, 0xf444e0, 0xc0006487a0, 0xc00079a568, 0x40cb
01, 0xc00068e600)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.c
om/hashicorp/[email protected]/helper/schema/resource.go:403 +0x8f
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plu
gin-sdk/helper/schema.(*Provider).ReadDataApply(0xc00078a980, 0xc000788e00, 0xc000796da0, 0xc00068e600, 0x100, 0x1c5ffff
)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.c
om/hashicorp/[email protected]/helper/schema/provider.go:451 +0x96
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plu
gin-sdk/plugin.(*ResourceProviderServer).ReadDataApply(0xc00070b0a0, 0xc000794710, 0xc000794880, 0x0, 0x0)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.c
om/hashicorp/[email protected]/plugin/resource_provider.go:607 +0x55
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: reflect.Value.call(0xc000206480, 0
xc000006098, 0x13, 0xf8917f, 0x4, 0xc000075f08, 0x3, 0x3, 0xc000075f34, 0xc000784300, ...)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x
64/src/reflect/value.go:460 +0x8b2
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: reflect.Value.Call(0xc000206480, 0
xc000006098, 0x13, 0xc000075f08, 0x3, 0x3, 0x55a9fca3c68, 0xc000292000, 0xc000292000)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x
64/src/reflect/value.go:321 +0xbb
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: net/rpc.(*service).call(0xc0000760
40, 0xc00064a190, 0xc000094050, 0xc000094060, 0xc00016e480, 0xc000648180, 0xdb84e0, 0xc000794710, 0x16, 0xdb8520, ...)
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x
64/src/net/rpc/server.go:377 +0x186
2020-09-06T11:53:38.481+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: created by net/rpc.(*Server).Serve
Codec
2020-09-06T11:53:38.482+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x
64/src/net/rpc/server.go:474 +0x432
2020/09/06 11:53:38 [ERROR] root: eval: *terraform.EvalReadDataApply, err: data.hetznerdns_zone.dns_zone: unexpected EOF

2020/09/06 11:53:38 [ERROR] root: eval: *terraform.EvalSequence, err: data.hetznerdns_zone.dns_zone: unexpected EOF
2020/09/06 11:53:38 [TRACE] [walkRefresh] Exiting eval tree: data.hetznerdns_zone.dns_zone
2020/09/06 11:53:38 [TRACE] dag/walk: upstream errored, not walking "provider.hetznerdns (close)"
2020/09/06 11:53:38 [TRACE] dag/walk: upstream errored, not walking "root"
2020/09/06 11:53:38 [DEBUG] plugin: waiting for all plugin processes to complete...
2020-09-06T11:53:38.497+0200 [WARN ] plugin: error closing client during Kill: err="connection is shut down"
2020-09-06T11:53:38.501+0200 [DEBUG] plugin.terraform-provider-hcloud_v1.15.0_x4.exe: 2020/09/06 11:53:38 [ERR] plugin:
plugin server: accept tcp 127.0.0.1:10001: use of closed network connection
...
Error: rpc error: code = Unavailable desc = transport is closing

0.12.29:

data.hetznerdns_zone.dns_zone: Refreshing state...                                                                                                                                                                                  
                                                                                                                                                                                                                                    
Warning: Interpolation-only expressions are deprecated                                                                                                                                                                              
                                                                                                                                                                                                                                    
  on 15_providers.tf line 14, in provider "hcloud":                                                                                                                                                                                 
  14:   token = "${var.hcloud_token}"                                                                                                                                                                                               
                                                                                                                                                                                                                                    
Terraform 0.11 and earlier required all non-constant expressions to be                                                                                                                                                              
provided via interpolation syntax, but this pattern is now deprecated. To                                                                                                                                                           
silence this warning, remove the "${ sequence from the start and the }"                                                                                                                                                             
sequence from the end of this expression, leaving just the inner expression.                                                                                                                                                        
                                                                                                                                                                                                                                    
Template interpolation syntax is still used to construct strings from                                                                                                                                                               
expressions when the template includes multiple interpolation sequences or a                                                                                                                                                        
mixture of literal strings and interpolations. This deprecation applies only                                                                                                                                                        
to templates that consist entirely of a single interpolation sequence.                                                                                                                                                              
                                                                                                                                                                                                                                    
(and opanic: runtime error: invalid memory address or nil pointer dereference                                                                                                                                                       
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: [signal 0xc0000005 code=0x0 addr=0x18 pc=0xd4ef12]                                                                                            
n2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:                                                                                                                                              
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: goroutine 66 [running]:                                                                                                                       
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/timohirt/terraform-provider-hetznerdns/hetznerdns.dataSourceHetznerDNSZoneRead(0xc0002920e0, 0xf444e0, 0xc0000907e0, 0xc0002920e0, 
e2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/work/terraform-provider-hetznerdns/terraform-provider-hetznerdns/hetznerdns/data_source_zone.go:40 +0x162                      
 2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).ReadDataApply(0xc0004567e0, 0xc000694980, 0xf444e0, 0xc0000907e0, 0xc0005
, 0x0)                                                                                                                                                                                                                              
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/resource.go:403 +0x8f                               
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).ReadDataApply(0xc0000ae880, 0xc0003a1ad0, 0xc000694980, 0xc000694980, 0x0,
o2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/provider.go:451 +0x96                               
r2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ReadDataSource(0xc00008e4c8, 0x11d3340, 0xc0001e8120, 
00, 0xc00008e4c8, 0xc0001e8120, 0xc0005c3b78)                                                                                                                                                                                       
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:1036 +0x464               
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadDataSource_Handler(0xf502e0, 0xc00008e4c8, 0x11d3340, 0xc0001e8120,
 660, 0x0, 0x11d3340, 0xc0001e8120, 0xc0002030e0, 0x30)                                                                                                                                                                             
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   s/home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3341 +0x21e                   
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000644900, 0x11dd780, 0xc000645380, 0xc0005da000, 0xc00017ef00, 0x189fb50, 0x0, 0x0, 0x0) 
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1024 +0x508                                                                
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).handleStream(0xc000644900, 0x11dd780, 0xc000645380, 0xc0005da000, 0x0)                                       
m2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1313 +0xd44                                                                
i2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00056c160, 0xc000644900, 0x11dd780, 0xc000645380, 0xc0005da000)                     
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   l/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:722 +0xa8                                                                 
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: created by google.golang.org/grpc.(*Server).serveStreams.func1                                                                                
2020-09-06T12:00:45.819+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:720 +0xa8                                                                  
2020/09/06 12:00:45 [ERROR] <root>: eval: *terraform.EvalReadData, err: rpc error: code = Unavailable desc = transport is closing                                                                                                   
r2020/09/06 12:00:45 [ERROR] <root>: eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing                                                                                                  
2020/09/06 12:00:45 [TRACE] [walkRefresh] Exiting eval tree: data.hetznerdns_zone.dns_zone                                                                                                                                          
2020/09/06 12:00:45 [TRACE] vertex "data.hetznerdns_zone.dns_zone": visit complete                                                                                                                                                  
 2020/09/06 12:00:45 [TRACE] vertex "data.hetznerdns_zone.dns_zone": dynamic subgraph encountered errors                                                                                                                            
2020/09/06 12:00:45 [TRACE] vertex "data.hetznerdns_zone.dns_zone": visit complete                                                                                                                                                  
2020/09/06 12:00:45 [TRACE] dag/walk: upstream of "provider.hetznerdns (close)" errored, so skipping                                                                                                                                
w2020/09/06 12:00:45 [TRACE] dag/walk: upstream of "root" errored, so skipping                                                                                                                                                      
2020/09/06 12:00:45 [TRACE] statemgr.Filesystem: removing lock metadata file terraform.tfstate.d\production\.terraform.tfstate.lock.info                                                                                            
2020/09/06 12:00:45 [TRACE] statemgr.Filesystem: unlocked by closing terraform.tfstate.d\production\terraform.tfstate                                                                                                               
2020-09-06T12:00:45.832+0200 [DEBUG] plugin: plugin exited                                                                                                                                                                          
                                                                                                                                                                                                                                    
rning elsewhere)  
...
Error: rpc error: code = Unavailable desc = transport is closing                                                                                                                                                                                                                  

0.13.1:

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.hetznerdns_zone.dns_zone: Refreshing state...

Warning: Interpolation-only expressions are deprecated

  on 15_providers.tf line 14, in provider "hcloud":
  14:   token = "${var.hcloud_token}"

Terraform 0.11 and earlier required all non-constant expressions to be
provided via interpolation syntax, but this pattern is now deprecated. To
silence this warning, remove the "${ sequence from the start and the }"
sequence from the end of this expression, leaving just the inner expression.

Template interpolation syntax is still used to construct strings from
expressions when the template includes multiple interpolation sequences or a
mixture of literal strings and interpolations. This deprecation applies only
to templates that consist entirely of a single interpolation sequence.

(and opanic: runtime error: invalid memory address or nil pointer dereference
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: [signal 0xc0000005 code=0x0 addr=0x18 pc=0xd4ef12]
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: goroutine 51 [running]:
n2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/timohirt/terraform-provider-hetznerdns/hetznerdns.dataSourceHetznerDNSZoneRead(0xc00038e070, 0xf444e0, 0xc0005285c0, 0xc00038e070, 0x0)
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   e/home/runner/work/terraform-provider-hetznerdns/terraform-provider-hetznerdns/hetznerdns/data_source_zone.go:40 +0x162
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).ReadDataApply(0xc000456750, 0xc00020c220, 0xf444e0, 0xc0005285c0, 0xc0004fe7d8, 0x1, 0x0)
 2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/resource.go:403 +0x8f
m2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).ReadDataApply(0xc00020e900, 0xc000297ad0, 0xc00020c220, 0xc00020c220, 0x0, 0x0)
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   o/home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/provider.go:451 +0x96
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ReadDataSource(0xc00020a4b8, 0x11d3340, 0xc00058a030, 0xc00064c040, 0xc00020a4b8, 0xc00058a030, 0xc00023fb78)
r2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:1036 +0x464
e2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadDataSource_Handler(0xf502e0, 0xc00020a4b8, 0x11d3340, 0xc00058a030, 0xc0002081e0, 0x0, 0x11d3340, 0xc00058a030, 0xc00002e690, 0x30)
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3341 +0x21e
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).processUnaryRPC(0xc000434c00, 0x11dd780, 0xc000584600, 0xc000300000, 0xc000115080, 0x189fb50, 0x0, 0x0, 0x0)
s2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1024 +0x508
i2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).handleStream(0xc000434c00, 0x11dd780, 0xc000584600, 0xc000300000, 0x0)
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   m/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1313 +0xd44
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000206180, 0xc000434c00, 0x11dd780, 0xc000584600, 0xc000300000)
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:722 +0xa8
2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: created by google.golang.org/grpc.(*Server).serveStreams.func1
l2020-09-06T12:04:56.126+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:  /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:720 +0xa8
a2020/09/06 12:04:56 [ERROR] eval: *terraform.evalReadDataRefresh, err: rpc error: code = Unavailable desc = transport is closing
2020/09/06 12:04:56 [ERROR] eval: *terraform.EvalSequence, err: rpc error: code = Unavailable desc = transport is closing
2020/09/06 12:04:56 [TRACE] [walkRefresh] Exiting eval tree: data.hetznerdns_zone.dns_zone
r2020/09/06 12:04:56 [TRACE] vertex "data.hetznerdns_zone.dns_zone": visit complete
2020/09/06 12:04:56 [TRACE] vertex "data.hetznerdns_zone.dns_zone": dynamic subgraph encountered errors
2020/09/06 12:04:56 [TRACE] vertex "data.hetznerdns_zone.dns_zone": visit complete
 2020/09/06 12:04:56 [TRACE] vertex "data.hetznerdns_zone.dns_zone (expand)": dynamic subgraph encountered errors
2020/09/06 12:04:56 [TRACE] vertex "data.hetznerdns_zone.dns_zone (expand)": visit complete
2020/09/06 12:04:56 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/timohirt/hetznerdns\"] (close)" errored, so skipping
w2020/09/06 12:04:56 [TRACE] dag/walk: upstream of "root" errored, so skipping
2020/09/06 12:04:56 [TRACE] statemgr.Filesystem: removing lock metadata file terraform.tfstate.d\production\.terraform.tfstate.lock.info
2020/09/06 12:04:56 [TRACE] statemgr.Filesystem: unlocked by closing terraform.tfstate.d\production\terraform.tfstate
a2020-09-06T12:04:56.139+0200 [DEBUG] plugin: plugin process exited: path=.terraform/plugins/registry.terraform.io/timohirt/hetznerdns/1.1.0/windows_amd64/terraform-provider-hetznerdns_v1.1.0.exe pid=6200 error="exit status 2"
2020-09-06T12:04:56.139+0200 [DEBUG] plugin: plugin exited

rning elsewhere)
...
Error: rpc error: code = Unavailable desc = transport is closing

zone_id should not be required for creating a record

comming from the powerdns provider where the id of a zone is simply its name, the current implemenation of the provider (and api?) is a little bit un-DRY

we have to write:

resource "hetznerdns_zone" "example_at" {
    name = "example.at"
    ttl = 3600
}
data "hetznerdns_zone" "example_at" {
    name = "example_at"
}
resource "hetznerdns_record" "example_at" {
    zone_id = "${hetznerdns_zone.example_at.id}"
    name = "@"
    value = "127.0.0.1"
    type = "A"
    ttl= 3600
}

instead of simply

resource "hetznerdns_zone" "example_at" {
    name = "example.at"
    ttl = 3600
}
resource "hetznerdns_record" "example_at" {
    zone = "example.at"
    name = "@"
    value = "127.0.0.1"
    type = "A"
    ttl= 3600
}

i assume this is because of hetzners api implemenation but maybe it would be more handy to abstract that and make the datasource access internal.

changing an existing resource results in a crash

resource "hetznerdns_zone" "example_at" {
    name = "example.at"
    ttl = 3600
}

data "hetznerdns_zone" "example_at" {
    name = "example_at"
}

resource "hetznerdns_record" "mx1_example_at" {
    zone_id = "${hetznerdns_zone.example_at.id}"
    name = "www"
    value = "example.at."
    type = "CNAME"
    ttl= 3600
}
hetznerdns_zone.example_at: Refreshing state... (ID: Fm3kcKJT8ZWDiVy3458xD4)
data.hetznerdns_zone.example_at: Refreshing state...
hetznerdns_record.example_at: Refreshing state... (ID: 1f58249e1e293868678d40e0d40f97d7)

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ hetznerdns_record.example_at
      name: "@" => "www"


Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions in workspace "production"?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

hetznerdns_record.example_at: Modifying... (ID: 1f58249e1e293868678d40e0d40f97d7)
  name: "@" => "www"

Error: Error applying plan:

1 error occurred:
        * hetznerdns_record.example_at: 1 error occurred:
        * hetznerdns_record.example_at: unexpected EOF





Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

panic: interface conversion: interface {} is int, not *int
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: goroutine 107 [running]:
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/timohirt/terraform-provider-hetznerdns/hetznerdns.resourceRecordUpdate(0xc0003a45b0, 0xf444e0, 0xc000209020, 0x24, 0x18dbb40)
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/work/terraform-provider-hetznerdns/terraform-provider-hetznerdns/hetznerdns/resource_record.go:147 +0x74b
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000458e10, 0xc00025d220, 0xc000666ac0, 0xf444e0, 0xc000209020, 0xc00060ba01, 0xc00026dbd0, 0x40cb20)
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/resource.go:316 +0x26a
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc000096f00, 0xc000669080, 0xc00025d220, 0xc000666ac0, 0xc000665020, 0xc0006643c0, 0x18)
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/helper/schema/provider.go:294 +0xa0
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: github.com/hashicorp/terraform-plugin-sdk/plugin.(*ResourceProviderServer).Apply(0xc0002089a0, 0xc0006666a0, 0xc0006703b0, 0x0, 0x0)
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/plugin/resource_provider.go:530 +0x5e
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: reflect.Value.call(0xc000086240, 0xc000006c48, 0x13, 0xf8917f, 0x4, 0xc00026df08, 0x3, 0x3, 0xc00026df34, 0x497ca5faa80, ...)
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:460 +0x8b2
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: reflect.Value.Call(0xc000086240, 0xc000006c48, 0x13, 0xc00026df08, 0x3, 0x3, 0x497ca5faa80, 0xc00078c000, 0xc00078c000)
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x64/src/reflect/value.go:321 +0xbb
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: net/rpc.(*service).call(0xc00027e740, 0xc000076960, 0xc00008a8c0, 0xc00008a8d0, 0xc000096f80, 0xc000208ee0, 0xdb8220, 0xc0006666a0, 0x16, 0xdb8260, ...)

2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x64/src/net/rpc/server.go:377 +0x186
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe: created by net/rpc.(*Server).ServeCodec
2020-09-07T10:37:08.045+0200 [DEBUG] plugin.terraform-provider-hetznerdns_v1.1.0.exe:   /opt/hostedtoolcache/go/1.14.7/x64/src/net/rpc/server.go:474 +0x432
2020/09/07 10:37:08 [TRACE] root: eval: *terraform.EvalWriteState
2020/09/07 10:37:08 [TRACE] root: eval: *terraform.EvalApplyProvisioners
2020/09/07 10:37:08 [TRACE] root: eval: *terraform.EvalIf
2020/09/07 10:37:08 [TRACE] root: eval: *terraform.EvalWriteState
2020/09/07 10:37:08 [TRACE] root: eval: *terraform.EvalWriteDiff
2020/09/07 10:37:08 [TRACE] root: eval: *terraform.EvalApplyPost
2020/09/07 10:37:08 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error occurred:
        * hetznerdns_record.example_at: unexpected EOF

2020/09/07 10:37:08 [ERROR] root: eval: *terraform.EvalSequence, err: 1 error occurred:
        * hetznerdns_record.example_at: unexpected EOF

2020/09/07 10:37:08 [TRACE] [walkApply] Exiting eval tree: hetznerdns_record.example_at
2020/09/07 10:37:08 [TRACE] dag/walk: upstream errored, not walking "provider.hetznerdns (close)"
2020/09/07 10:37:08 [TRACE] dag/walk: upstream errored, not walking "meta.count-boundary (count boundary fixup)"
2020/09/07 10:37:08 [TRACE] dag/walk: upstream errored, not walking "root"
2020/09/07 10:37:08 [TRACE] Preserving existing state lineage "0a04f514-e78a-bfa4-d095-760033b00edb"
2020/09/07 10:37:08 [TRACE] Preserving existing state lineage "0a04f514-e78a-bfa4-d095-760033b00edb"
2020/09/07 10:37:08 [TRACE] Preserving existing state lineage "0a04f514-e78a-bfa4-d095-760033b00edb"
2020/09/07 10:37:08 [TRACE] Preserving existing state lineage "0a04f514-e78a-bfa4-d095-760033b00edb"
2020/09/07 10:37:08 [DEBUG] plugin: waiting for all plugin processes to complete...
2020-09-07T10:37:08.054+0200 [WARN ] plugin: error closing client during Kill: err="connection is shut down"

Suggestion: Hand over the project to https://github.com/hetznercloud GitHub organization

Hey,

you did an awesome job. Your terraform provider helped me a lot setting up my infrastructure.
I would love to see this project flourish.

From the age of the tickets I derive that you don't have much time right now to maintain this project. Correct me if I'm wrong :)

Handing over your project to https://github.com/hetznercloud would help the folks over at Hetzner to govern everything regarding their cloud products under one umbrella.

If you don't like the idea oder I'm totally wrong, just close the ticket.

Best regards and a nice weekend
Stefan

Error: Error creating DNS record ...: Error creating record ...: API returned HTTP 422 Unprocessable Entity error with message: '409 Conflict: '

Terraform provider for Hetzner DNS is great, thanks!

I have a bug, that seems to be a timing problem. "long run" in my "real world" is an ansible playbook.

Source-Code Tree is:

.
├── main.tf
├── modules
│   └── dns
│       └── main.tf
├── terraform.tfstate
├── terraform.tfstate.backup
└── terraform.tfvars

2 directories, 5 files

terraform version :

Terraform v1.0.10
on linux_amd64
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/timohirt/hetznerdns v1.1.1

./main.tf :

variable "hetzner_dns_api_token" {
  type = string
}

module "dns_ipv4" {
    source = "./modules/dns"

    hetzner_dns_api_token = var.hetzner_dns_api_token

    dns_zone_name      = "with42.de"
    dns_record_name    = "test"
    dns_record_value   = "23.88.119.215"
    dns_record_type    = "A"
    dns_record_ttl     = 60
}

module "dns_ipv6" {
    source = "./modules/dns"

    hetzner_dns_api_token = var.hetzner_dns_api_token

    dns_zone_name      = "with42.de"
    dns_record_name    = "test"
    dns_record_value   = "2a01:4f8:c17:4d56::1"
    dns_record_type    = "AAAA"
    dns_record_ttl     = 60
}

resource "null_resource" "long_run" {
  provisioner "local-exec" {
    command = "sleep 30"
  }
}

./modules/dns/main.tf :

terraform {
  required_providers {
    hetznerdns = {
      source  = "timohirt/hetznerdns"
      version = "1.1.1"
    }
  }
  required_version = ">= 0.14"
}

variable "hetzner_dns_api_token" {
  type = string
}

provider "hetznerdns" {
  apitoken = var.hetzner_dns_api_token
}

variable "dns_zone_name" {
  type = string
}

data "hetznerdns_zone" "dns_zone" {
  name = var.dns_zone_name
}

variable "dns_record_name" {
  type = string
}

variable "dns_record_type" {
  type    = string
}

variable "dns_record_value" {
  type = string
}

variable "dns_record_ttl" {
  type    = number
}

resource "hetznerdns_record" "dns_record" {
  zone_id = data.hetznerdns_zone.dns_zone.id
  name    = var.dns_record_name
  value   = var.dns_record_value
  type    = var.dns_record_type
  ttl     = var.dns_record_ttl
}

terraform apply --auto-approve

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # null_resource.long_run will be created
  + resource "null_resource" "long_run" {
      + id = (known after apply)
    }

  # module.dns_ipv4.hetznerdns_record.dns_record will be created
  + resource "hetznerdns_record" "dns_record" {
      + id      = (known after apply)
      + name    = "test"
      + ttl     = 60
      + type    = "A"
      + value   = "23.88.119.215"
      + zone_id = "Q7FSkRDBKn7s4AcbyfsCS9"
    }

  # module.dns_ipv6.hetznerdns_record.dns_record will be created
  + resource "hetznerdns_record" "dns_record" {
      + id      = (known after apply)
      + name    = "test"
      + ttl     = 60
      + type    = "AAAA"
      + value   = "2a01:4f8:c17:4d56::1"
      + zone_id = "Q7FSkRDBKn7s4AcbyfsCS9"
    }

Plan: 3 to add, 0 to change, 0 to destroy.
null_resource.long_run: Creating...
null_resource.long_run: Provisioning with 'local-exec'...
null_resource.long_run (local-exec): Executing: ["/bin/sh" "-c" "sleep 30"]
module.dns_ipv4.hetznerdns_record.dns_record: Creating...
module.dns_ipv6.hetznerdns_record.dns_record: Creating...
module.dns_ipv4.hetznerdns_record.dns_record: Creation complete after 0s [id=c804985fe43c09aedc042c2ac091c313]
null_resource.long_run: Still creating... [10s elapsed]
null_resource.long_run: Still creating... [20s elapsed]
null_resource.long_run: Still creating... [30s elapsed]
null_resource.long_run: Creation complete after 30s [id=4482767035045673271]
│
│ Error: Error creating DNS record test: Error creating record test: API returned HTTP 422 Unprocessable Entity error with message: '409 Conflict: '
│
│   with module.dns_ipv6.hetznerdns_record.dns_record,
│   on modules/dns/main.tf line 43, in resource "hetznerdns_record" "dns_record":
│   43: resource "hetznerdns_record" "dns_record" {
│
│

Sorry for the long snippets, I can also provide the output with TF_LOG=trace if necessary.

Hitting rate limit (without hitting it)

We manage our whole DNS infrastructure with this plugin and now started getting Error getting record with id <id>: Error getting Record. HTTP status 429 unhandled for every resource. The Hetzner docs say it's limited to 3600 requests per hour, however bursts are allowed. AFAIK, running terraform plan is a burst request. We currently manage 841 resources (entries) over 48 domains and it failed already on the first try.

It was working for us until last month, we didn't change anything so far, just added two additional records, but it's failing on plan now. We are on plugin version 2.0.0.

Someone aware, was there a change on Hetzner side? Or maybe someone experienced same issue? Is it even possible to run terraform "slower" to not to hit the rate limits?

DNS record will not be destroyed, when DNS zone has the prevent_destroy flag

I have a DNS zone (example.com), in which I deploy multiple instances of the same Terraform script (with different names, of course).

To prevent the DNS zone from being deleted when terraform destroy has been issued, I have protected my DNS zone from being destroyed.

resource "hetznerdns_zone" "example_com_dns_zone" {
  name = "example.com"
  ttl  = 86400
  lifecycle { prevent_destroy = true }
}

Unfortunately, on a destroy, no DNS records will be destroyed, even though I marked the DNS records as "do not prevent destroy".

resource "hetznerdns_record" "server_example_com_dns_record_a" {
  zone_id = hetznerdns_zone.example_com_dns_zone.id
  name    = "server"
  type    = "A"
  value   = "127.0.0.1"
  ttl     = 60
  lifecycle { prevent_destroy = false }
}

Please delete DNS records, when they are not protected, but the DNS zone is.

The current version (2.1.0) will not delete the DNS records, despite being not protected.

Only synchronize write API operations

Read commit message of 3109ecf for context.

Currently, all API requests are serialized. This slows read and write operations down. It should be ok to multiple read resources and data sources at the same time, so synchronization is not required in this case.

Cannot update to 1.2.0: Failed to query available provider packages

When I change the version from 1.1.1 to 1.2.0 at

        hetznerdns = {
            source = "timohirt/hetznerdns"
            version = "1.2.0"
        }

... and run terraform init -upgrade, I'm getting:

Initializing provider plugins...
- Finding hetznercloud/hcloud versions matching "1.32.2"...
- Finding timohirt/hetznerdns versions matching "1.1.1, 1.2.0"...
- Using previously-installed hetznercloud/hcloud v1.32.2
╷
│ Error: Failed to query available provider packages
│ 
│ Could not retrieve the list of available versions for provider timohirt/hetznerdns: no available releases match the given constraints 1.1.1, 1.2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.