File tree 4 files changed +20
-9
lines changed
4 files changed +20
-9
lines changed Original file line number Diff line number Diff line change
1
+ terraform {
2
+ required_providers {
3
+ aws = {
4
+ source = " hashicorp/aws"
5
+ version = " ~> 5.0"
6
+ }
7
+ }
8
+ }
9
+
1
10
data "aws_caller_identity" "current" {}
2
11
data "aws_region" "current" {}
3
12
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ resource "aws_pinpoint_email_channel" "email" {
9
9
10
10
application_id = aws_pinpoint_app. project [each . key ]. application_id
11
11
from_address = each. value . from_email
12
- identity = aws_ses_email_identity. email [each . value . from_email ]. arn
12
+ # domain identify (if domain identity verification), if not then Email identity
13
+ identity = (each. value . verify_domain_identity ) ? aws_ses_domain_identity. domain [split (" @" , each. value . from_email )[1 ]]. arn : aws_ses_email_identity. email [each . value . from_email ]. arn
13
14
role_arn = aws_iam_role. pinpoint [each . key ]. arn
14
15
}
Original file line number Diff line number Diff line change 1
1
locals {
2
- valid_from_emails = [for p in local . projects_need_email : p . from_email ]
3
- valid_to_emails = flatten ([for p in local . projects_need_email : (p. to_emails != null ) ? p . to_emails : []])
4
- email_identities = toset (distinct (concat (local. valid_from_emails , local. valid_to_emails )))
5
-
6
- valid_domains = [for p in local . projects_need_email : split (" @" , p. from_email )[1 ]]
7
- domain_identities = toset (distinct (local. valid_domains ))
8
-
2
+ valid_domains = [for p in local . projects_need_email : split (" @" , p. from_email )[1 ]]
3
+ domain_identities = toset (distinct (local. valid_domains ))
9
4
valid_domains_to_verify = [for p in local . projects_need_domain_verification : split (" @" , p. from_email )[1 ]]
10
5
domains_to_verify = toset (distinct (local. valid_domains_to_verify ))
11
6
}
Original file line number Diff line number Diff line change
1
+ locals {
2
+ valid_from_emails = [for p in local . projects_need_email : p . from_email ]
3
+ from_emails_for_identities = flatten ([for p in local . projects_need_email : (p. verify_domain_identity ) ? [] : [p . from_email ]])
4
+ valid_to_emails = flatten ([for p in local . projects_need_email : (p. to_emails != null ) ? p . to_emails : []])
5
+ emails_for_identities = toset (distinct (concat (local. from_emails_for_identities , local. valid_to_emails )))
6
+ }
1
7
2
8
# create all Email identities
3
9
resource "aws_ses_email_identity" "email" {
4
- for_each = local. email_identities
10
+ for_each = local. emails_for_identities
5
11
6
12
email = each. value
7
13
}
You can’t perform that action at this time.
0 commit comments