feat(iac/gke): codify mail static IPs + cert-manager into tofu - #1139
Merged
Conversation
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).
Contributor
There was a problem hiding this comment.
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_addressresources for the pre-reserved SMTP/IMAP external IPs (with import guidance). - Installs cert-manager via
helm_releaseand scaffolds a DNS-01ClusterIssuergated 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the mail cloud-infra reproducible (
tofu apply), per the IaC-first rule — no manual gcloud.What lands
google_compute_addressws-smtp / ws-imap — the two IPs reserved imperatively to unblock (130.211.115.191,136.116.203.17). The file carriestofu importstanzas so state adopts the existing addresses instead of recreating them.helm_releasecert-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.count-gated off until a Cloud DNS delegation zone exists.mail.*/imap.*are L4 (no HTTP-01), andsocioprophet.aiis 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 fmtclean,tofu validateSuccess (providers: google/helm/kubernetes already declared in the env).Follow-ups (companion)
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.acme_email+acme_dns01_projectto switch the issuer on.mail.socioprophet.ai(once the LB forwarding rule exists).🤖 Generated with Claude Code