Skip to content
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
33 changes: 31 additions & 2 deletions ses-domain-identity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ This module allows you to setup domain identification for SES with the following

## Usage

See `variables.tf` for the full argument reference.
### With a literal zone ID

```hcl
module "ses_doamin_identity" {
module "ses_domain_identity" {
source = "github.com/script47/aws-tf-modules/ses-domain-identity"

zone_id = "zone-id"
Expand Down Expand Up @@ -41,3 +41,32 @@ module "ses_doamin_identity" {
}
}
```

### With a resource-derived zone ID

If `zone_id` comes from a resource created in the same apply (e.g. `aws_route53_zone`), set `manage_dns_records = true` explicitly. Without it, Terraform cannot evaluate the `count` at plan time and will error with "Invalid count argument".

```hcl
module "ses_domain_identity" {
source = "github.com/script47/aws-tf-modules/ses-domain-identity"

zone_id = aws_route53_zone.zone.id
manage_dns_records = true
domain = "example.org"
}
```

### Without DNS management

To create the SES domain identity without managing Route53 records, set `manage_dns_records = false`. `zone_id` can then be omitted.

```hcl
module "ses_domain_identity" {
source = "github.com/script47/aws-tf-modules/ses-domain-identity"

manage_dns_records = false
domain = "example.org"
}
```

See `variables.tf` for the full argument reference.
2 changes: 1 addition & 1 deletion ses-domain-identity/route53.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
locals {
configure_dns = var.zone_id != null
configure_dns = var.manage_dns_records
spf_record = join(
" ",
concat(
Expand Down
11 changes: 11 additions & 0 deletions ses-domain-identity/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ variable "zone_id" {
type = string
description = "The ID of the hosted zone"
default = null

validation {
condition = !var.manage_dns_records || var.zone_id != null
error_message = "zone_id must be provided when manage_dns_records is true."
}
}

variable "manage_dns_records" {
type = bool
description = "Whether to create Route53 DNS records in the provided zone. Set to false to create the SES domain identity without managing DNS."
default = true
}

variable "domain" {
Expand Down
Loading