Skip to content

Commit a18d054

Browse files
committed
add allowed sending addresses variable
1 parent 90b2ace commit a18d054

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

main.tf

+5-11
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ resource "aws_iam_group" "ses_users" {
4848
}
4949

5050
## IAM Group Policies for SES Domain Identity
51+
locals {
52+
allowed_sending_addresses = var.allowed_sending_addresses != [] ? var.allowed_sending_addresses : ["*@${var.domain}"]
53+
}
54+
5155
data "aws_iam_policy_document" "ses_group_sending_policy" {
5256
statement {
5357
effect = "Allow"
@@ -65,17 +69,7 @@ data "aws_iam_policy_document" "ses_group_sending_policy" {
6569
condition {
6670
test = "StringLike"
6771
variable = "ses:FromAddress"
68-
values = [
69-
"*@${var.domain}"
70-
]
71-
}
72-
73-
condition {
74-
test = "StringLike"
75-
variable = "ses:FeedbackAddress"
76-
values = [
77-
"*@${var.domain}"
78-
]
72+
values = local.allowed_sending_addresses
7973
}
8074
}
8175
}

variables.tf

+9
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,12 @@ variable "group_path" {
2323
description = "The IAM Path of the group and policy to create"
2424
default = "/"
2525
}
26+
27+
variable "allowed_sending_addresses" {
28+
type = list(string)
29+
description = <<EOT
30+
A list of email addresses that are allowed to send email from the domain.
31+
If this list is empty, the domain will be configured to allow any email address to send email from the domain.
32+
EOT
33+
default = []
34+
}

0 commit comments

Comments
 (0)