From a1778b2e3a252dfa45f53914b6eb91a24204a4b6 Mon Sep 17 00:00:00 2001 From: Jorge Falcon <22119513+BCTBB@users.noreply.github.com> Date: Fri, 31 Oct 2025 16:08:41 -0400 Subject: [PATCH] Updates SES module to support toggling policy creation on and off (#129) - Addded variable `create_iam_policy` to drive policy creation. Defaults to `true` --- addons/ses/main.tf | 4 +++- addons/ses/outputs.tf | 2 +- addons/ses/variables.tf | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/ses/main.tf b/addons/ses/main.tf index b1f8966..bcbc73b 100644 --- a/addons/ses/main.tf +++ b/addons/ses/main.tf @@ -63,10 +63,12 @@ resource "aws_route53_record" "dmarc_domain" { } resource "aws_iam_policy" "main" { - policy = data.aws_iam_policy_document.main.json + count = var.create_iam_policy ? 1 : 0 + policy = data.aws_iam_policy_document.main[0].json } data "aws_iam_policy_document" "main" { + count = var.create_iam_policy ? 1 : 0 statement { actions = [ "ses:SendEmail", diff --git a/addons/ses/outputs.tf b/addons/ses/outputs.tf index 0e22664..6c09126 100644 --- a/addons/ses/outputs.tf +++ b/addons/ses/outputs.tf @@ -7,6 +7,6 @@ output "fleet_extra_environment_variables" { output "fleet_extra_iam_policies" { value = [ - aws_iam_policy.main.arn + var.create_iam_policy ? aws_iam_policy.main[0].arn : null ] } diff --git a/addons/ses/variables.tf b/addons/ses/variables.tf index 6a13b13..9a0abec 100644 --- a/addons/ses/variables.tf +++ b/addons/ses/variables.tf @@ -25,3 +25,9 @@ variable "custom_mail_from" { } description = "Custom MAIL FROM domain settings" } + +variable "create_iam_policy" { + type = bool + default = true + description = "Create IAM policy for the SES email sending. (Default: true)" +} \ No newline at end of file