Skip to content

RecordSet

Source: src/Hetzner/RecordSet.ts

A Hetzner Cloud DNS resource record set (RRSet) — one (name, type) with one or more records. Two A values are a single resource, not two.

Identity is (zone, name, type): changing any of those replaces the RRSet. Records, TTL, labels, and change protection update in place. Only primary Zones accept RRSet edits.

A records on a subdomain

const zone = yield* Hetzner.Zone("example", {
name: "example.com",
});
const www = yield* Hetzner.RecordSet("www", {
zone,
name: "www",
type: "A",
records: [
{ value: "192.0.2.1" },
{ value: "192.0.2.2" },
],
ttl: 300,
});

Apex A record from a Primary IP

const ip = yield* Hetzner.PrimaryIp("web-ip", {
type: "ipv4",
location: "nbg1",
});
const apex = yield* Hetzner.RecordSet("apex", {
zone,
name: "@",
type: "A",
records: [{ value: ip.ip }],
});
const www = yield* Hetzner.RecordSet("www", {
zone,
name: "www",
type: "A",
records: [{ value: "192.0.2.10" }],
ttl: 600,
});