added sns topic for ses debugging:

This commit is contained in:
Khalim Conn-Kowlessar 2026-03-05 16:35:42 +00:00
parent b227fb47fa
commit 2312b65819
3 changed files with 38 additions and 8 deletions

View file

@ -12,6 +12,35 @@ resource "aws_iam_user" "ses_user" {
name = "${var.stage}-ses-user"
}
# SES configuration set for tracking events
resource "aws_ses_configuration_set" "this" {
name = "${var.stage}-ses-config"
}
# SNS topic for SES event notifications
resource "aws_sns_topic" "ses_events" {
name = "${var.stage}-ses-events"
}
# SES event destination for debugging
resource "aws_ses_event_destination" "sns" {
name = "ses-event-destination"
configuration_set_name = aws_ses_configuration_set.this.name
enabled = true
matching_types = [
"send",
"bounce",
"reject",
"complaint",
"delivery"
]
sns_destination {
topic_arn = aws_sns_topic.ses_events.arn
}
}
resource "aws_iam_user_policy" "ses_send_policy" {
name = "AllowSESSendEmail"
user = aws_iam_user.ses_user.name
@ -20,8 +49,8 @@ resource "aws_iam_user_policy" "ses_send_policy" {
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = [
Effect = "Allow"
Action = [
"ses:SendEmail",
"ses:SendRawEmail"
]
@ -42,9 +71,9 @@ resource "aws_secretsmanager_secret" "ses_smtp" {
}
resource "aws_secretsmanager_secret_version" "ses_smtp" {
secret_id = aws_secretsmanager_secret.ses_smtp.id
secret_id = aws_secretsmanager_secret.ses_smtp.id
secret_string = jsonencode({
username = aws_iam_access_key.ses_user.id
password = aws_iam_access_key.ses_user.ses_smtp_password_v4
})
}
}

View file

@ -7,3 +7,4 @@ variable "stage" {
description = "Deployment stage (e.g. dev, prod)"
type = string
}

View file

@ -28,15 +28,15 @@ from sqlalchemy import func
# PORTFOLIO_ID = 206
# SCENARIOS = [389]
PORTFOLIO_ID = 597
PORTFOLIO_ID = 581
SCENARIOS = [
1099
1124
]
scenario_names = {
1099: "£10k cost capped - no solid wall or floor",
1124: "EPC C - Solar Focused",
}
project_name = "Livespace Rentals"
project_name = "WCHG EPC D rated properties"
def get_data(portfolio_id, scenario_ids):