amazon-web-servicesterraformterraform-provider-awsamazon-ses

Use a managed SES IP pool in Terraform by default


I'd like to configure Terraform with a default SES configuration set that sends through an AWS managed IP pool. So far I have this:

resource "aws_sesv2_dedicated_ip_pool" "this" {
  pool_name = "default-app"
  scaling_mode = "MANAGED"
}

resource "aws_ses_configuration_set" "this" {
  name = "default-app"
}

I don't see how to set this as the default or how to associate the two in Terraform.


Solution

  • You have to use the Terraform SES v2 resources for managing the configuration set, as well as the SES identity, to make this work:

    # Create an IP Pool
    resource "aws_sesv2_dedicated_ip_pool" "this" {
      pool_name = "default-app"
      scaling_mode = "MANAGED"
    }
    
    # Create a configuration set that uses the IP pool
    resource "aws_sesv2_configuration_set" "this" {
      configuration_set_name = "default-app"
    
      delivery_options {
        sending_pool_name = aws_sesv2_dedicated_ip_pool.this.pool_name
      }
    }
    
    # Create an email identity that uses the configuration set by default
    resource "aws_sesv2_email_identity" "this" {
      email_identity         = "example.com"
      configuration_set_name = aws_sesv2_configuration_set.this.configuration_set_name
    }