From 4b6df665f3a214fc4732178a3b184c29bd638209 Mon Sep 17 00:00:00 2001 From: Jamie Brunton Date: Sat, 24 Jan 2026 21:25:44 +0000 Subject: [PATCH] Fix Terraform type coercion in SMTP settings merge Separate string and numeric settings into different locals to prevent merge() from coercing integers to strings. The Supabase API requires rate_limit_email_sent to be an integer. Co-Authored-By: Claude Opus 4.5 --- terraform/modules/supabase/main.tf | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/terraform/modules/supabase/main.tf b/terraform/modules/supabase/main.tf index 3be8c64..6849fb3 100644 --- a/terraform/modules/supabase/main.tf +++ b/terraform/modules/supabase/main.tf @@ -207,19 +207,23 @@ locals { # require Team plan or higher - omitted to avoid 402 errors } - # Production-only SMTP settings (completely omitted for non-prod) - auth_smtp = var.is_production ? { - smtp_admin_email = "team@send.sauci.app" - smtp_host = "smtp.resend.com" + # Production-only SMTP string settings (completely omitted for non-prod) + auth_smtp_strings = var.is_production ? { + smtp_admin_email = "team@send.sauci.app" + smtp_host = "smtp.resend.com" + smtp_port = "465" + smtp_sender_name = "Sauci App" + smtp_user = "resend" + } : {} + + # Production-only numeric settings (separate to preserve int type) + auth_smtp_numbers = var.is_production ? { smtp_max_frequency = 1 - smtp_port = "465" - smtp_sender_name = "Sauci App" - smtp_user = "resend" rate_limit_email_sent = 25 } : {} # Final merged auth config - auth_config = merge(local.auth_base, local.auth_smtp) + auth_config = merge(local.auth_base, local.auth_smtp_strings, local.auth_smtp_numbers) } resource "supabase_settings" "main" {