DNS

DNS zones and records at Cloudflare or Route 53, kept as you set them.

Overview

A DNS zone is a domain you own at Cloudflare or Route 53. EnclaveStack keeps the records you add, puts them back if they are changed elsewhere, and can point a record at this machine.

When to use it

  • Point shop.example.com at this machine.
  • Wildcard certificates.
  • All DNS records next to the rest of your setup.

How it works

DNS provider plug-ins
Cloudflare’s API with a scoped token; Route 53’s API signed with SigV4.
Records
A, AAAA, CNAME and TXT; records EnclaveStack manages are marked so others are left alone.

The control plane checks the token’s access, then writes each record at the provider. A record pointed at the machine follows its public address.

Architecture

DNS architectureEnclaveStack keeps records at your DNS provider.tokenupsertControl planeAPI · reconciler · SQLiteCloudflare or Route 53APIshop.example.comA record
EnclaveStack keeps records at your DNS provider.
  • Control plane to Cloudflare or Route 53: token
  • Cloudflare or Route 53 to shop.example.com: upsert

Flows

Pointing a name at the machine

  1. Store a provider token as a secret.
  2. Create the zone, then a record with Point at this machine.
  3. When the machine’s public address changes, the record follows.

Set it up

In the console

  1. Store the provider token as a secret.
  2. Open DNS and choose New zone.
  3. Open the zone and Add record.

With the CLI

enclave zone create example --provider cloudflare --zone example.com --credentials cloudflare-token

With OpenTofu

OpenTofu configuration
resource "enclave_zone" "example" {
  name               = "example"
  dns_provider       = "cloudflare"
  zone               = "example.com"
  credentials_secret = "cloudflare-token"
}

Settings reference

Every setting and output of the OpenTofu resource; the console and the CLI use the same names in their own words. Generated from platform 4d30582.

enclave_zone
NameTypeUseWhat it does
credentials_secrettextrequiredSecret holding {"apiToken"} (Cloudflare: Zone:Read and DNS:Edit) or {"accessKeyId","secretAccessKey"} (Route 53).
dns_providertextrequiredcloudflare or route53 ("provider" is reserved by OpenTofu). Changing it replaces the zone.
nametextrequiredName of the zone: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the zone.
zonetextrequiredThe zone's name, e.g. example.com. Changing it replaces the zone.
projecttextoptionalThe project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource.
idtextoutputResource ID.
name_serverslist of textoutputThe zone's name servers.
zone_idtextoutputThe provider's zone ID.
enclave_record
NameTypeUseWhat it does
nametextrequiredName of the record: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the record.
record_nametextrequiredName inside the zone: "api", "@" for the zone itself, "*.dev" for a wildcard.
typetextrequiredA, AAAA, CNAME or TXT.
zonetextrequiredName of the enclave_zone it belongs to.
machinetrue or falseoptionalPoint an A or AAAA record at the machine's public address, and follow it when it changes.
projecttextoptionalThe project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource.
ttlnumberoptionalTTL in seconds (60–86400).
valueslist of textoptionalValues. Exactly one of values or machine.
fqdntextoutputThe record's full name.
idtextoutputResource ID.

Limits and security

Good to know

  • Cloudflare and Route 53.

Security

  • Give the token only the rights to edit that zone’s DNS; it is stored encrypted.