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 <noreply@anthropic.com>
This commit is contained in:
jjbruntonandClaude Opus 4.5 committed 2026-01-24 21:25:44 +00:00
1 parent c309fbaa98
commit 4b6df665f3
1 file changed
+8 -4
+8 -4
View File
@@ -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 ? {
# 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_max_frequency = 1
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
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" {