Skip to content

feat(iac/gke): codify mail static IPs + cert-manager into tofu - #1139

Merged
mdheller merged 1 commit into
mainfrom
feat/gke-mail-addresses-certmanager
Jul 30, 2026
Merged

feat(iac/gke): codify mail static IPs + cert-manager into tofu#1139
mdheller merged 1 commit into
mainfrom
feat/gke-mail-addresses-certmanager

Conversation

@mdheller

Copy link
Copy Markdown
Member

Makes the mail cloud-infra reproducible (tofu apply), per the IaC-first rule — no manual gcloud.

What lands

  • google_compute_address ws-smtp / ws-imap — the two IPs reserved imperatively to unblock (130.211.115.191, 136.116.203.17). The file carries tofu import stanzas so state adopts the existing addresses instead of recreating them.
  • helm_release cert-manager (v1.16.2) — auto-renewing TLS. GKE ManagedCertificates only work on HTTP(S) ingress, not the L4 SMTP/IMAP LoadBalancers, so cert-manager is the sovereign fit here.
  • DNS-01 ClusterIssuer scaffold, count-gated off until a Cloud DNS delegation zone exists. mail.*/imap.* are L4 (no HTTP-01), and socioprophet.ai is manual at Namecheap, so the automatable path is CNAME-delegating _acme-challenge.{mail,imap} to Cloud DNS. Ships disabled so we never deploy a half-configured issuer.

Verified

tofu fmt clean, tofu validate Success (providers: google/helm/kubernetes already declared in the env).

Follow-ups (companion)

  1. kustomize LB Services (infra/k8s/workspace-mail): workspace-smtp-lb (25/587 → ws-smtp IP) + workspace-imap-lb (993 → ws-imap IP) — ArgoCD owns app-layer resources. This is what actually exposes mail externally; sequence TLS before MX cutover.
  2. Cloud DNS delegation zone + one-time Namecheap CNAMEs → then set acme_email + acme_dns01_project to switch the issuer on.
  3. PTR on ws-smtp → mail.socioprophet.ai (once the LB forwarding rule exists).

🤖 Generated with Claude Code

Cloud-side infra for the mail plane, in tofu instead of imperative gcloud:
- google_compute_address ws-smtp / ws-imap (the two reserved to unblock — IMPORT stanzas
  in the file so state ADOPTS them, never recreates).
- helm_release cert-manager (v1.16.2) — auto-renewing TLS for the L4 SMTP/IMAP endpoints
  (GKE ManagedCertificates only cover HTTP(S) ingress, so cert-manager is the sovereign fit).
- A DNS-01 ClusterIssuer scaffold, count-gated OFF until a Cloud DNS delegation zone exists
  (mail.* is L4 so HTTP-01 can't work; socioprophet.ai is manual at Namecheap, so the
  automatable path is CNAME-delegating _acme-challenge to Cloud DNS). Never ship a half issuer.

Validated: tofu fmt + tofu validate. Apply/import is gated (GCS backend, owner).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Codifies the Workspace mail cloud-side prerequisites in OpenTofu by bringing existing static IP reservations under state and deploying cert-manager to enable DNS-01 TLS issuance for L4 SMTP/IMAP endpoints.

Changes:

  • Adds two google_compute_address resources for the pre-reserved SMTP/IMAP external IPs (with import guidance).
  • Installs cert-manager via helm_release and scaffolds a DNS-01 ClusterIssuer gated behind required variables.
  • Exposes reserved IPs via outputs for DNS/MX configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

value = "true"
}

depends_on = [helm_release.argocd]
Comment on lines +36 to +39
set {
name = "crds.enabled"
value = "true"
}
spec = {
acme = {
email = var.acme_email
server = "https://acme-v02.api.letsencrypt.org/directory"
@mdheller
mdheller merged commit 3029514 into main Jul 30, 2026
46 of 47 checks passed
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.

2 participants