/ smtp.tf
smtp.tf
 1  /* SMTP Cerdentials -----------------------------*/
 2  
 3  /**
 4   * For more details see:
 5   * https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-connect.html
 6   **/
 7  
 8  resource "aws_iam_user" "smtp" {
 9    name = "ses-smtp-user.dap-ps"
10  }
11  
12  resource "aws_iam_access_key" "smtp" {
13    user    = aws_iam_user.smtp.name
14    pgp_key = file("files/support@dap.ps.gpg")
15  }
16  
17  resource "aws_iam_policy" "smtp" {
18    name        = "AmazonSesSendingAccess"
19    description = "Policy that gives Write access to SES Sending"
20  
21    policy = <<EOF
22  {
23      "Version": "2012-10-17",
24      "Statement": [
25          {
26              "Effect": "Allow",
27              "Action": [
28                "SES:SendEmail",
29                "SES:SendRawEmail"
30              ],
31              "Resource": "*"
32          }
33      ]
34  }
35  EOF
36  
37  }
38  
39  resource "aws_iam_user_policy_attachment" "smtp" {
40    user = aws_iam_user.smtp.name
41    policy_arn = aws_iam_policy.smtp.arn
42  }