Skip to content

ZoneCustomNameservers

Source: src/Cloudflare/Zone/CustomNameservers.ts

Controls whether a Cloudflare zone uses account-level custom nameservers (ACNS, /zones/{zone_id}/custom_ns).

This configuration is a zone singleton — it always exists on every zone (disabled by default), so the resource never creates or deletes anything physical. Reconcile applies the desired enabled/nsSet when the observed configuration differs; destroy restores the configuration the zone had before Alchemy first managed it.

Enabling requires an account custom nameserver set to be configured first (Business/Enterprise feature). Without one, Cloudflare rejects the update with the typed CustomNameserverSetNotFound error.

Use the account’s default nameserver set

yield* Cloudflare.ZoneCustomNameservers("CustomNs", {
zoneId: zone.zoneId,
enabled: true,
});

Pin a specific nameserver set

yield* Cloudflare.ZoneCustomNameservers("CustomNs", {
zoneId: zone.zoneId,
enabled: true,
nsSet: 2,
});
yield* Cloudflare.ZoneCustomNameservers("CustomNs", {
zoneId: zone.zoneId,
enabled: false,
});