Skip to content

Commit 177f3d3

Browse files
authored
feat: support the new DNS API (#1210)
Add support for the new [DNS API](https://docs.hetzner.cloud/reference/cloud#dns). The DNS API is currently in **beta**. See the [DNS API beta changelog](https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta) for more details.
1 parent 78a8bb8 commit 177f3d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3900
-1
lines changed

.golangci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ linters:
4242
exhaustive:
4343
default-signifies-exhaustive: true
4444
staticcheck:
45-
checks: ["all", "-QF1008"]
45+
checks: ["all", "-QF1008", "-S1016"]
4646

4747
exclusions:
4848
generated: lax

docs/data-sources/zone.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "hcloud_zone Data Source - hcloud"
4+
subcategory: ""
5+
description: |-
6+
Provides details about a Hetzner Cloud Zone.
7+
For Internationalized domain names (IDN), see the provider::hcloud::idna function.
8+
See the Zones API documentation https://docs.hetzner.cloud/reference/cloud#zones for more details.
9+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
10+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
11+
---
12+
13+
# hcloud_zone (Data Source)
14+
15+
Provides details about a Hetzner Cloud Zone.
16+
17+
For Internationalized domain names (IDN), see the `provider::hcloud::idna` function.
18+
19+
See the [Zones API documentation](https://docs.hetzner.cloud/reference/cloud#zones) for more details.
20+
21+
**Experimental:** DNS API is in beta, breaking changes may occur within minor releases.
22+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
23+
24+
## Example Usage
25+
26+
```terraform
27+
data "hcloud_zone" "by_id" {
28+
id = 1234
29+
}
30+
31+
data "hcloud_zone" "by_name" {
32+
name = "example.com"
33+
}
34+
35+
data "hcloud_zone" "by_label" {
36+
with_selector = "key=value"
37+
}
38+
```
39+
40+
<!-- schema generated by tfplugindocs -->
41+
## Schema
42+
43+
### Optional
44+
45+
- `id` (Number) ID of the Zone.
46+
- `name` (String) Name of the Zone.
47+
- `with_selector` (String) Filter results using a [Label Selector](https://docs.hetzner.cloud/reference/cloud#label-selector).
48+
49+
### Read-Only
50+
51+
- `authoritative_nameservers` (Attributes) Authoritative nameservers of the Zone. (see [below for nested schema](#nestedatt--authoritative_nameservers))
52+
- `delete_protection` (Boolean) Whether delete protection is enabled.
53+
- `labels` (Map of String) User-defined [labels](https://docs.hetzner.cloud/reference/cloud#labels) (key-value pairs) for the resource.
54+
- `mode` (String) Mode of the Zone.
55+
- `primary_nameservers` (Attributes List) Primary nameservers of the Zone. (see [below for nested schema](#nestedatt--primary_nameservers))
56+
- `registrar` (String) Registrar of the Zone.
57+
- `ttl` (Number) Default Time To Live (TTL) of the Zone.
58+
59+
<a id="nestedatt--authoritative_nameservers"></a>
60+
### Nested Schema for `authoritative_nameservers`
61+
62+
Read-Only:
63+
64+
- `assigned` (List of String) Authoritative Hetzner nameservers assigned to the Zone.
65+
66+
67+
<a id="nestedatt--primary_nameservers"></a>
68+
### Nested Schema for `primary_nameservers`
69+
70+
Read-Only:
71+
72+
- `address` (String) Public IPv4 or IPv6 address of the primary nameserver.
73+
- `port` (Number) Port of the primary nameserver.
74+
- `tsig_algorithm` (String) Transaction signature (TSIG) algorithm used to generate the TSIG key.
75+
- `tsig_key` (String) Transaction signature (TSIG) key

docs/data-sources/zone_rrset.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "hcloud_zone_rrset Data Source - hcloud"
4+
subcategory: ""
5+
description: |-
6+
Provides details about a Hetzner Cloud Zone Resource Record Set (RRSet).
7+
See the Zone RRSets API documentation https://docs.hetzner.cloud/reference/cloud#zone-rrsets for more details.
8+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
9+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
10+
---
11+
12+
# hcloud_zone_rrset (Data Source)
13+
14+
Provides details about a Hetzner Cloud Zone Resource Record Set (RRSet).
15+
16+
See the [Zone RRSets API documentation](https://docs.hetzner.cloud/reference/cloud#zone-rrsets) for more details.
17+
18+
**Experimental:** DNS API is in beta, breaking changes may occur within minor releases.
19+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
20+
21+
## Example Usage
22+
23+
```terraform
24+
data "hcloud_zone" "example" {
25+
name = "example.com"
26+
}
27+
28+
data "hcloud_zone_rrset" "by_id" {
29+
zone = data.hcloud_zone.example.name
30+
id = "www/A"
31+
}
32+
33+
data "hcloud_zone_rrset" "by_name_and_type" {
34+
zone = data.hcloud_zone.example.name
35+
name = "www"
36+
type = "A"
37+
}
38+
39+
data "hcloud_zone_rrset" "by_label" {
40+
zone = data.hcloud_zone.example.name
41+
with_selector = "key=value"
42+
}
43+
```
44+
45+
<!-- schema generated by tfplugindocs -->
46+
## Schema
47+
48+
### Required
49+
50+
- `zone` (String) ID or Name of the parent Zone.
51+
52+
### Optional
53+
54+
- `id` (String) ID of the Zone RRSet.
55+
- `name` (String) Name of the Zone RRSet.
56+
- `type` (String) Type of the Zone RRSet.
57+
- `with_selector` (String) Filter results using a [Label Selector](https://docs.hetzner.cloud/reference/cloud#label-selector).
58+
59+
### Read-Only
60+
61+
- `change_protection` (Boolean) Whether change protection is enabled.
62+
- `labels` (Map of String) User-defined [labels](https://docs.hetzner.cloud/reference/cloud#labels) (key-value pairs) for the resource.
63+
- `records` (Attributes List) Records of the Zone RRSet. (see [below for nested schema](#nestedatt--records))
64+
- `ttl` (Number) Time To Live (TTL) of the Zone RRSet.
65+
66+
<a id="nestedatt--records"></a>
67+
### Nested Schema for `records`
68+
69+
Read-Only:
70+
71+
- `comment` (String) Comment of the record.
72+
- `value` (String) Value of the record.

docs/data-sources/zone_rrsets.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "hcloud_zone_rrsets Data Source - hcloud"
4+
subcategory: ""
5+
description: |-
6+
Provides a list of Hetzner Cloud Zone Resource Record Set (RRSet).
7+
See the Zone RRSets API documentation https://docs.hetzner.cloud/reference/cloud#zone-rrsets for more details.
8+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
9+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
10+
---
11+
12+
# hcloud_zone_rrsets (Data Source)
13+
14+
Provides a list of Hetzner Cloud Zone Resource Record Set (RRSet).
15+
16+
See the [Zone RRSets API documentation](https://docs.hetzner.cloud/reference/cloud#zone-rrsets) for more details.
17+
18+
**Experimental:** DNS API is in beta, breaking changes may occur within minor releases.
19+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
20+
21+
## Example Usage
22+
23+
```terraform
24+
data "hcloud_zone" "example" {
25+
name = "example.com"
26+
}
27+
28+
data "hcloud_zone_rrsets" "all" {
29+
zone = data.hcloud_zone.example.name
30+
}
31+
32+
data "hcloud_zone_rrsets" "by_label" {
33+
zone = data.hcloud_zone.example.name
34+
with_selector = "key=value"
35+
}
36+
```
37+
38+
<!-- schema generated by tfplugindocs -->
39+
## Schema
40+
41+
### Required
42+
43+
- `zone` (String) ID or Name of the parent Zone.
44+
45+
### Optional
46+
47+
- `with_selector` (String) Filter results using a [Label Selector](https://docs.hetzner.cloud/reference/cloud#label-selector)
48+
49+
### Read-Only
50+
51+
- `id` (String) The ID of this resource.
52+
- `rrsets` (Attributes List) (see [below for nested schema](#nestedatt--rrsets))
53+
54+
<a id="nestedatt--rrsets"></a>
55+
### Nested Schema for `rrsets`
56+
57+
Optional:
58+
59+
- `zone` (String) ID or Name of the parent Zone.
60+
61+
Read-Only:
62+
63+
- `change_protection` (Boolean) Whether change protection is enabled.
64+
- `id` (String) ID of the Zone RRSet.
65+
- `labels` (Map of String) User-defined [labels](https://docs.hetzner.cloud/reference/cloud#labels) (key-value pairs) for the resource.
66+
- `name` (String) Name of the Zone RRSet.
67+
- `records` (Attributes List) Records of the Zone RRSet. (see [below for nested schema](#nestedatt--rrsets--records))
68+
- `ttl` (Number) Time To Live (TTL) of the Zone RRSet.
69+
- `type` (String) Type of the Zone RRSet.
70+
71+
<a id="nestedatt--rrsets--records"></a>
72+
### Nested Schema for `rrsets.records`
73+
74+
Read-Only:
75+
76+
- `comment` (String) Comment of the record.
77+
- `value` (String) Value of the record.

docs/data-sources/zones.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "hcloud_zones Data Source - hcloud"
4+
subcategory: ""
5+
description: |-
6+
Provides a list of Hetzner Cloud Zone.
7+
See the Zones API documentation https://docs.hetzner.cloud/reference/cloud#zones for more details.
8+
Experimental: DNS API is in beta, breaking changes may occur within minor releases.
9+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
10+
---
11+
12+
# hcloud_zones (Data Source)
13+
14+
Provides a list of Hetzner Cloud Zone.
15+
16+
See the [Zones API documentation](https://docs.hetzner.cloud/reference/cloud#zones) for more details.
17+
18+
**Experimental:** DNS API is in beta, breaking changes may occur within minor releases.
19+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
20+
21+
## Example Usage
22+
23+
```terraform
24+
data "hcloud_zones" "all" {}
25+
26+
data "hcloud_zones" "by_label" {
27+
with_selector = "key=value"
28+
}
29+
```
30+
31+
<!-- schema generated by tfplugindocs -->
32+
## Schema
33+
34+
### Optional
35+
36+
- `with_selector` (String) Filter results using a [Label Selector](https://docs.hetzner.cloud/reference/cloud#label-selector)
37+
38+
### Read-Only
39+
40+
- `id` (String) The ID of this resource.
41+
- `zones` (Attributes List) (see [below for nested schema](#nestedatt--zones))
42+
43+
<a id="nestedatt--zones"></a>
44+
### Nested Schema for `zones`
45+
46+
Read-Only:
47+
48+
- `authoritative_nameservers` (Attributes) Authoritative nameservers of the Zone. (see [below for nested schema](#nestedatt--zones--authoritative_nameservers))
49+
- `delete_protection` (Boolean) Whether delete protection is enabled.
50+
- `id` (Number) ID of the Zone.
51+
- `labels` (Map of String) User-defined [labels](https://docs.hetzner.cloud/reference/cloud#labels) (key-value pairs) for the resource.
52+
- `mode` (String) Mode of the Zone.
53+
- `name` (String) Name of the Zone.
54+
- `primary_nameservers` (Attributes List) Primary nameservers of the Zone. (see [below for nested schema](#nestedatt--zones--primary_nameservers))
55+
- `registrar` (String) Registrar of the Zone.
56+
- `ttl` (Number) Default Time To Live (TTL) of the Zone.
57+
58+
<a id="nestedatt--zones--authoritative_nameservers"></a>
59+
### Nested Schema for `zones.authoritative_nameservers`
60+
61+
Read-Only:
62+
63+
- `assigned` (List of String) Authoritative Hetzner nameservers assigned to the Zone.
64+
65+
66+
<a id="nestedatt--zones--primary_nameservers"></a>
67+
### Nested Schema for `zones.primary_nameservers`
68+
69+
Read-Only:
70+
71+
- `address` (String) Public IPv4 or IPv6 address of the primary nameserver.
72+
- `port` (Number) Port of the primary nameserver.
73+
- `tsig_algorithm` (String) Transaction signature (TSIG) algorithm used to generate the TSIG key.
74+
- `tsig_key` (String) Transaction signature (TSIG) key

docs/functions/idna.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "idna function - hcloud"
4+
subcategory: ""
5+
description: |-
6+
Convert a Internationalized Domain Name (IDN) to ASCII
7+
---
8+
9+
# function: idna
10+
11+
Converts a Internationalized Domain Name (IDN) to ASCII using Punycode.
12+
13+
The conversion is defined by Golang's IDNA package. See https://pkg.go.dev/golang.org/x/net/idna
14+
for more details.
15+
16+
**Experimental:** DNS API is in beta, breaking changes may occur within minor releases.
17+
See https://docs.hetzner.cloud/changelog#2025-10-07-dns-beta for more details.
18+
19+
## Example Usage
20+
21+
```terraform
22+
resource "hcloud_zone" "example" {
23+
name = provider::hcloud::idna("exämple-🍪.com")
24+
mode = "primary"
25+
}
26+
```
27+
28+
## Signature
29+
30+
<!-- signature generated by tfplugindocs -->
31+
```text
32+
idna(domain string) string
33+
```
34+
35+
## Arguments
36+
37+
<!-- arguments generated by tfplugindocs -->
38+
1. `domain` (String) Domain to convert.

0 commit comments

Comments
 (0)