Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: send IdP emails using SES SMTP server #715

Merged
merged 2 commits into from
Jul 3, 2024
Merged

Conversation

patheard
Copy link
Member

@patheard patheard commented Jul 3, 2024

Summary

Add SES configuration and an IAM user so that the IdP can send email using the SES SMTP server.

Also updates the database configuration to add connection pool settings as we are currently not using an RDS proxy to manage the connection pooling.

Related

Add SES configuration and an IAM user so that the IdP can send
email using the SES SMTP server.

Also updates the database configuration to add connection pool
settings as we are currently not using an RDS proxy to manage
the connection pooling.
@patheard patheard self-assigned this Jul 3, 2024
Copy link

github-actions bot commented Jul 3, 2024

⚠ Terrform update available

Terraform: 1.9.1 (using 1.6.6)
Terragrunt: 0.59.6 (using 0.54.8)

Copy link

github-actions bot commented Jul 3, 2024

Staging: idp

✅   Terraform Init: success
✅   Terraform Validate: success
✅   Terraform Format: success
✅   Terraform Plan: success
✅   Conftest: success

Plan: 9 to add, 0 to change, 0 to destroy
Show summary
CHANGE NAME
add aws_iam_access_key.idp_send_email
aws_iam_group.idp_send_email
aws_iam_group_membership.idp_send_email
aws_iam_group_policy_attachment.idp_send_email
aws_iam_policy.idp_send_email
aws_iam_user.idp_send_email
aws_route53_record.idp_ses_verification_TXT
aws_ses_domain_identity.idp
aws_ses_domain_identity_verification.idp
Show plan
Resource actions are indicated with the following symbols:
  + create
 <= read (data resources)

Terraform will perform the following actions:

  # data.aws_iam_policy_document.idp_send_email will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "idp_send_email" {
      + id   = (known after apply)
      + json = (known after apply)

      + statement {
          + actions   = [
              + "ses:SendRawEmail",
            ]
          + effect    = "Allow"
          + resources = [
              + (known after apply),
            ]
        }
    }

  # aws_iam_access_key.idp_send_email will be created
  + resource "aws_iam_access_key" "idp_send_email" {
      + create_date                    = (known after apply)
      + encrypted_secret               = (known after apply)
      + encrypted_ses_smtp_password_v4 = (known after apply)
      + id                             = (known after apply)
      + key_fingerprint                = (known after apply)
      + secret                         = (sensitive value)
      + ses_smtp_password_v4           = (sensitive value)
      + status                         = "Active"
      + user                           = "idp_send_email"
    }

  # aws_iam_group.idp_send_email will be created
  + resource "aws_iam_group" "idp_send_email" {
      + arn       = (known after apply)
      + id        = (known after apply)
      + name      = "idp_send_email"
      + path      = "/"
      + unique_id = (known after apply)
    }

  # aws_iam_group_membership.idp_send_email will be created
  + resource "aws_iam_group_membership" "idp_send_email" {
      + group = "idp_send_email"
      + id    = (known after apply)
      + name  = "idp_send_email"
      + users = [
          + "idp_send_email",
        ]
    }

  # aws_iam_group_policy_attachment.idp_send_email will be created
  + resource "aws_iam_group_policy_attachment" "idp_send_email" {
      + group      = "idp_send_email"
      + id         = (known after apply)
      + policy_arn = (known after apply)
    }

  # aws_iam_policy.idp_send_email will be created
  + resource "aws_iam_policy" "idp_send_email" {
      + arn         = (known after apply)
      + id          = (known after apply)
      + name        = "idp_send_email"
      + name_prefix = (known after apply)
      + path        = "/"
      + policy      = (known after apply)
      + policy_id   = (known after apply)
      + tags_all    = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
    }

  # aws_iam_user.idp_send_email will be created
  + resource "aws_iam_user" "idp_send_email" {
      + arn           = (known after apply)
      + force_destroy = false
      + id            = (known after apply)
      + name          = "idp_send_email"
      + path          = "/"
      + tags_all      = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + unique_id     = (known after apply)
    }

  # aws_route53_record.idp_ses_verification_TXT will be created
  + resource "aws_route53_record" "idp_ses_verification_TXT" {
      + allow_overwrite = (known after apply)
      + fqdn            = (known after apply)
      + id              = (known after apply)
      + name            = (known after apply)
      + records         = (known after apply)
      + ttl             = 600
      + type            = "TXT"
      + zone_id         = "Z05990652HOQ0SGHD81ZC"
    }

  # aws_ses_domain_identity.idp will be created
  + resource "aws_ses_domain_identity" "idp" {
      + arn                = (known after apply)
      + domain             = "auth.forms-staging.cdssandbox.xyz"
      + id                 = (known after apply)
      + verification_token = (known after apply)
    }

  # aws_ses_domain_identity_verification.idp will be created
  + resource "aws_ses_domain_identity_verification" "idp" {
      + arn    = (known after apply)
      + domain = (known after apply)
      + id     = (known after apply)
    }

Plan: 9 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: plan.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "plan.tfplan"
Show Conftest results
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.idp_send_email"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_user.idp_send_email"]
WARN - plan.json - main - Missing Common Tags: ["aws_shield_protection.idp"]

22 tests, 19 passed, 3 warnings, 0 failures, 0 exceptions

Comment on lines +18 to +21
MaxOpenConns: 200
MaxIdleConns: 20
MaxConnLifetime: 1800
MaxConnIdleTime: 1800
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all just best guesses at the moment. We'll need to tune them over time.

Copy link
Contributor

@craigzour craigzour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@patheard patheard merged commit f1150e7 into develop Jul 3, 2024
11 checks passed
@patheard patheard deleted the feat/idp-smtp branch July 3, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants