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

remove unnecessary resource, add resource dependencies, remove unused… #137

Merged
merged 2 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ No modules.
| [aws_route53_record.mx_send_mail_from](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
| [aws_route53_record.spf_mail_from](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
| [aws_route53_record.txt_dmarc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
| [aws_ses_domain_dkim.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ses_domain_dkim) | resource |
| [aws_ses_receipt_rule.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ses_receipt_rule) | resource |
| [aws_sesv2_email_identity.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sesv2_email_identity) | resource |
| [aws_sesv2_email_identity_mail_from_attributes.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sesv2_email_identity_mail_from_attributes) | resource |
Expand All @@ -102,7 +101,6 @@ No modules.
| enable\_dmarc | Control whether to create DMARC TXT record. | `bool` | `true` | no |
| enable\_incoming\_email | Control whether or not to handle incoming emails. | `bool` | `true` | no |
| enable\_spf\_record | Control whether or not to set SPF records. | `bool` | `true` | no |
| extra\_ses\_records | Extra records to add to the \_amazonses TXT record. | `list(string)` | `[]` | no |
| from\_addresses | List of email addresses to catch bounces and rejections. | `list(string)` | `null` | no |
| mail\_from\_domain | Subdomain (of the route53 zone) which is to be used as MAIL FROM address | `string` | n/a | yes |
| receive\_s3\_bucket | Name of the S3 bucket to store received emails (required if enable\_incoming\_email is true). | `string` | `""` | no |
Expand Down
1 change: 0 additions & 1 deletion examples/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ module "ses_domain" {
receive_s3_prefix = local.ses_bucket_prefix
enable_verification = var.enable_verification
enable_spf_record = var.enable_spf_record
extra_ses_records = var.extra_ses_records

ses_rule_set = var.rule_set
}
5 changes: 0 additions & 5 deletions examples/simple/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ variable "enable_spf_record" {
type = bool
}

variable "extra_ses_records" {
type = list(string)
default = []
}

variable "rule_set" {
description = "Name of the SES rule set to associate rules with."
type = string
Expand Down
16 changes: 6 additions & 10 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,16 @@ resource "aws_sesv2_email_identity" "main" {
# SES DKIM Verification
#

resource "aws_ses_domain_dkim" "main" {
domain = aws_sesv2_email_identity.main.email_identity
}

resource "aws_route53_record" "dkim" {
count = 3

zone_id = var.route53_zone_id
name = format(
"%s._domainkey.%s",
element(aws_ses_domain_dkim.main.dkim_tokens, count.index),
var.domain_name,
)
name = "${aws_sesv2_email_identity.main.dkim_signing_attributes[0].tokens[count.index]}._domainkey"
type = "CNAME"
ttl = "600"
records = ["${element(aws_ses_domain_dkim.main.dkim_tokens, count.index)}.dkim.amazonses.com"]
records = ["${aws_sesv2_email_identity.main.dkim_signing_attributes[0].tokens[count.index]}.dkim.amazonses.com"]

depends_on = [aws_sesv2_email_identity.main]
}

#
Expand All @@ -44,6 +38,8 @@ resource "aws_route53_record" "dkim" {
resource "aws_sesv2_email_identity_mail_from_attributes" "main" {
email_identity = aws_sesv2_email_identity.main.email_identity
mail_from_domain = local.stripped_mail_from_domain

depends_on = [aws_sesv2_email_identity.main]
}

# SPF validation record
Expand Down
6 changes: 0 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,3 @@ variable "enable_spf_record" {
type = bool
default = true
}

variable "extra_ses_records" {
description = "Extra records to add to the _amazonses TXT record."
type = list(string)
default = []
}