Skip to content

Commit

Permalink
update docs; add more code to move-to-production
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Mar 17, 2021
1 parent 5384fab commit dc3aded
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 13 deletions.
15 changes: 8 additions & 7 deletions ses-domain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

This sets up the domain identity for SES. We create by default `{account_id}.aws.mail.census.gov`
as a sender domain, and generate the details which are to be submitted to TCO for inclusion in DNS.
The contents of the file `setup/ses_dns.md` contain the text which goes to TCO. A future enhancement
The contents of the file `${path.root}/setup/ses_dns.md` contain the text which goes to TCO. A future enhancement
to this will include the ability to automatically incorporate the changes into DNS. This is a multi-step
setup:
setup:

1. Create initial resources
1. Provide TCO Details for DNS Update
1. Complete domain validation
Expand Down Expand Up @@ -39,11 +40,11 @@ This can be used without any variables to get the default configuration.
module "ses" {
source = "git@github.e.it.census.gov:terraform-modules/aws-inf-setup.git//ses-domain"
## optional
# ses_domain_name = "somerandomdomain.aws.mail.census.gov"
## optional, changing this is not recommended
# ses_domain_name = "123456789012.postal.census.gov"
## while these can be changed, it is not advised
ses_base_domain_name = "aws.mail.census.gov"
ses_base_dkim_domain_name = "dkim.amazonses.com"
# ses_base_domain_name = "aws.mail.census.gov"
# ses_base_dkim_domain_name = "dkim.amazonses.com"
}
```
## Create initial resources
Expand All @@ -53,7 +54,7 @@ module "ses" {

## Provide TCO DNS details

See and exmaple [ses\_dns.md](example.ses\_dns.md). This file will be in `setup/ses_dns.md`. Submit this to TCO to get the records added to DNS.
See and example [ses\_dns.md](example.ses\_dns.md). This file will be in `setup/ses_dns.md`. Submit this to TCO to get the records added to DNS.

## After DNS is updated
Once DNS has been updated, you can run `tf-apply` on the resource again. It will look for a non-empty value
Expand Down
50 changes: 50 additions & 0 deletions ses-domain/bin/move-to-production.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

# https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html

AWS=$(which aws 2>/dev/null)
if [ -z $AWS ]
then
echo "* aws CLI missing"
exit 1
fi
$AWS sesv2 help >/dev/null 2>&1
status=$?
if [ $status != 0 ]
then
echo "* aws sesv2 CLI missing"
exit 1
fi

if [ -z $SES_USE_CASE_DESCRIPTION ]
then
SES_USE_CASE_DESCRIPTION="Used for alerting and notification from lambda and other applications to users within our own enterprise mail system"
fi

if [ -z $SES_ADDITIONAL_CONTACT_EMAIL ]
then
SES_ADDITIONAL_CONTACT_EMAIL="donald.e.badrak.ii@census.gov,roy.d.ashley.jr@census.gov"
fi

$AWS sesv2 put-account-details \
--production-access-enabled \
--mail-type TRANSACTIONAL \
--use-case-description "$SES_USE_CASE_DESCRIPTION" \
--additional-contact-email-addresses "$SES_ADDITINAL_CONTACT_EMAIL" \
--contact-language EN
status=$?

if [ $status != 0 ]
then
echo "* error requesting production access for SES"
fi
exit $status

# unused options
# --website-url https://example.com
#
# env variables:
# AWS_DEFAULT_REGION
# AWS_PROFILE
# SES_ADDITIONAL_CONTACT_EMAIL
# SES_USE_CASE_DESCRIPTION
13 changes: 7 additions & 6 deletions ses-domain/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
*
* This sets up the domain identity for SES. We create by default `{account_id}.aws.mail.census.gov`
* as a sender domain, and generate the details which are to be submitted to TCO for inclusion in DNS.
* The contents of the file `setup/ses_dns.md` contain the text which goes to TCO. A future enhancement
* The contents of the file `${path.root}/setup/ses_dns.md` contain the text which goes to TCO. A future enhancement
* to this will include the ability to automatically incorporate the changes into DNS. This is a multi-step
* setup:
*
* 1. Create initial resources
* 1. Provide TCO Details for DNS Update
* 1. Complete domain validation
Expand Down Expand Up @@ -40,11 +41,11 @@
* module "ses" {
* source = "git@github.e.it.census.gov:terraform-modules/aws-inf-setup.git//ses-domain"
*
* ## optional
* # ses_domain_name = "somerandomdomain.aws.mail.census.gov"
* ## optional, changing this is not recommended
* # ses_domain_name = "123456789012.postal.census.gov"
* ## while these can be changed, it is not advised
* ses_base_domain_name = "aws.mail.census.gov"
* ses_base_dkim_domain_name = "dkim.amazonses.com"
* # ses_base_domain_name = "aws.mail.census.gov"
* # ses_base_dkim_domain_name = "dkim.amazonses.com"
* }
* ```
* ## Create initial resources
Expand All @@ -54,7 +55,7 @@
*
* ## Provide TCO DNS details
*
* See and exmaple [ses_dns.md](example.ses_dns.md). This file will be in `setup/ses_dns.md`. Submit this to TCO to get the records added to DNS.
* See and example [ses_dns.md](example.ses_dns.md). This file will be in `setup/ses_dns.md`. Submit this to TCO to get the records added to DNS.
*
* ## After DNS is updated
* Once DNS has been updated, you can run `tf-apply` on the resource again. It will look for a non-empty value
Expand Down

0 comments on commit dc3aded

Please sign in to comment.