From 3ad70175d8d66f90d69a2cf756cece545f4aafb5 Mon Sep 17 00:00:00 2001 From: "Aldo \"xoen\" Giambelluca" Date: Mon, 10 Sep 2018 14:42:13 +0100 Subject: [PATCH] Added SES SMTP user for Airflow The `ses_smtp_user` can be used to create an IAM user with permission to send emails from the specified SES Domain Identity. NOTE: The SMTP password for the user is not specified but it's an output of the IAM Access Key associated with the IAM user --- .../terraform/modules/ses_smtp_user/inputs.tf | 3 ++ infra/terraform/modules/ses_smtp_user/main.tf | 28 +++++++++++++++++++ .../modules/ses_smtp_user/outputs.tf | 3 ++ infra/terraform/platform/main.tf | 8 ++++++ infra/terraform/platform/outputs.tf | 4 +++ 5 files changed, 46 insertions(+) create mode 100644 infra/terraform/modules/ses_smtp_user/inputs.tf create mode 100644 infra/terraform/modules/ses_smtp_user/main.tf create mode 100644 infra/terraform/modules/ses_smtp_user/outputs.tf diff --git a/infra/terraform/modules/ses_smtp_user/inputs.tf b/infra/terraform/modules/ses_smtp_user/inputs.tf new file mode 100644 index 000000000..4692095de --- /dev/null +++ b/infra/terraform/modules/ses_smtp_user/inputs.tf @@ -0,0 +1,3 @@ +variable "ses_domain_identity_arn" {} + +variable "username" {} diff --git a/infra/terraform/modules/ses_smtp_user/main.tf b/infra/terraform/modules/ses_smtp_user/main.tf new file mode 100644 index 000000000..baa73224a --- /dev/null +++ b/infra/terraform/modules/ses_smtp_user/main.tf @@ -0,0 +1,28 @@ +resource "aws_iam_user" "smtp_user" { + name = "${var.username}" +} + +resource "aws_iam_access_key" "access_key" { + user = "${aws_iam_user.smtp_user.name}" +} + +resource "aws_iam_user_policy" "smtp_user_policy" { + name = "${aws_iam_user.smtp_user.name}_policy" + user = "${aws_iam_user.smtp_user.name}" + + policy = <