Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/dns-handover.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"externalDnsHandover": [
{ "type": "A", "name": "www.devantler.tech" },
{ "type": "AAAA", "name": "www.devantler.tech" }
]
"externalDnsHandover": []
}
29 changes: 4 additions & 25 deletions dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,10 @@ resource "cloudflare_dns_record" "apex" {
}

# external-dns serves www from the business site's public route. It took over
# the old www CNAME through a one-time ownership record (forgotten below) and
# replaced it with the gateway addresses. Its own ownership records for those
# addresses then disappeared, so these two restore them with external-dns's
# exact content. external-dns re-owns the existing www records without
# changing them. .github/dns-handover.json lists the two records they claim.
resource "cloudflare_dns_record" "www_external_dns_owner_a" {
zone_id = cloudflare_zone.primary.id
name = "_externaldns.a-www.devantler.tech"
type = "TXT"
content = "\"heritage=external-dns,external-dns/owner=platform.devantler.tech,external-dns/resource=httproute/business-site/business-site-public\""
ttl = 1
proxied = false
settings = {}
}

resource "cloudflare_dns_record" "www_external_dns_owner_aaaa" {
zone_id = cloudflare_zone.primary.id
name = "_externaldns.aaaa-www.devantler.tech"
type = "TXT"
content = "\"heritage=external-dns,external-dns/owner=platform.devantler.tech,external-dns/resource=httproute/business-site/business-site-public\""
ttl = 1
proxied = false
settings = {}
}

# the old www CNAME through a one-time ownership record (forgotten below),
# replaced it with the gateway addresses and owns them through its own
# `_externaldns.a-www` and `_externaldns.aaaa-www` records. This repository
# manages none of them.
removed {
from = cloudflare_dns_record.www_external_dns_owner

Expand Down
5 changes: 2 additions & 3 deletions scripts/tests/test-dns-apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,9 @@ for list in '{"externalDnsHandover":[{"type":"a","name":"www.devantler.tech"}]}'
printf '%s\n' "$list" > "$scratch/handover.json"
{ printf '%s\n' "$noop_import"; marker _externaldns.a-www.devantler.tech; } | reject "invalid handover list $list"
done
# The repository's own list is valid and admits exactly the www handover it was written for.
# The repository's own list is valid, so a typo in it cannot stop every DNS run.
cp "$root/.github/dns-handover.json" "$scratch/handover.json"
{ printf '%s\n' "$noop_import"; marker _externaldns.a-www.devantler.tech
change cloudflare_dns_record.marker_aaaa cloudflare_dns_record '["create"]' null '{"name":"_externaldns.aaaa-www.devantler.tech","type":"TXT","content":"x"}' null; } | plan | check
printf '%s\n' "$noop_import" | plan | check
printf '%s\n' '{"externalDnsHandover":[]}' > "$scratch/handover.json"
# A record external-dns owns is never written here, and every write has a known
# name (OpenTofu writes an unknown value as null).
Expand Down
Loading