Skip to content

feat(cloudflare): import email DNS records for perish.dev - #3

Merged
hasansezertasan merged 1 commit into
mainfrom
feat/import-cf-resources
Jun 25, 2026
Merged

hasansezertasan merged 1 commit into
mainfrom
feat/import-cf-resources

Conversation

@hasansezertasan

Copy link
Copy Markdown
Member

Summary

Brings the six existing Cloudflare DNS records that handle perish.dev email under Terraform management via cf-terraforming and Terraform 1.5+ `import` blocks.

  • 3× MX → `route1/2/3.mx.cloudflare.net` (Cloudflare Email Routing)
  • TXT SPF (`v=spf1 include:_spf.mx.cloudflare.net ~all`)
  • TXT DMARC (`_dmarc`, policy=none, reports to Cloudflare)
  • TXT DKIM (`cf2024-1._domainkey`)

What's intentionally NOT here

The apex `perish.dev` and `www` A records exist in Cloudflare but point at `192.0.2.1` (IANA TEST-NET-1 — unroutable). A Cloudflare Redirect Rule at the edge serves `perish.dev` → `github.com/perishdev`. Both are placeholder infrastructure.

The follow-up PR will:

  1. Create `perishdev/perishdev.github.io` with a README-based landing page.
  2. Replace the apex A records with the 4× GitHub Pages IPs and add a `www` CNAME.
  3. Remove the Cloudflare Redirect Rule manually.

Side fixes

  • `.gitignore`: exclude the terraform binary that cf-terraforming auto-downloads into each leaf working directory when `--terraform-binary-path` isn't passed.
  • `docs/import.md`: pass `--terraform-binary-path` and split `generate` / `import` calls — `--account` and `--zone` became mutually exclusive in cf-terraforming v0.27.

Test plan

  • `terraform validate` passes locally.
  • HCP speculative plan on this PR shows `6 to import, 0 to add, 0 to change, 0 to destroy`.
  • After merge: confirm apply in HCP UI; the six records land in state without recreation.
  • After apply: `dig +short MX perish.dev` still returns the three Cloudflare email routes.

Brings existing Cloudflare Email Routing records under Terraform
management via cf-terraforming + Terraform 1.5+ import blocks:

- 3× MX (route1/2/3.mx.cloudflare.net)
- TXT SPF (v=spf1 include:_spf.mx.cloudflare.net ~all)
- TXT DMARC (_dmarc, policy=none, reports to Cloudflare)
- TXT DKIM (cf2024-1._domainkey)

Apex (perish.dev) and www A records are intentionally NOT imported
here. They currently point at 192.0.2.1 (IANA TEST-NET-1) with a
Cloudflare Redirect Rule serving perish.dev -> github.com/perishdev
at the edge. The follow-up PR replaces them with GitHub Pages records
once perishdev/perishdev.github.io is live, after which the redirect
rule will be removed manually.

Also:
- .gitignore: exclude the terraform binary that cf-terraforming
  auto-downloads into each leaf when --terraform-binary-path is unset.
- docs/import.md: pass --terraform-binary-path and split the generate
  / import calls because --account and --zone are now mutually
  exclusive in cf-terraforming.

Expected HCP plan: 6 to import, 0 to add, 0 to change, 0 to destroy.
@hasansezertasan
hasansezertasan merged commit f3af9fa into main Jun 25, 2026
4 checks passed
@hasansezertasan
hasansezertasan deleted the feat/import-cf-resources branch June 25, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant