Skip to content

Commit

Permalink
fix(main): update domain references to use count (#17)
Browse files Browse the repository at this point in the history
Closes #16 

Previously: 

```hcl
resource "aws_ses_identity_policy" "default" {
  count    = var.enable_policy ? 1 : 0
  identity = aws_ses_domain_identity.default.*.arn
  name     = var.policy_name
  policy   = data.aws_iam_policy_document.document.json
}
```

Terraform expects a single identity here instead of a list so it errors. Updating it to use the count index solves the issue.


```hcl 
resource "aws_ses_identity_policy" "default" {
  count    = var.enable_policy ? 1 : 0
  identity = aws_ses_domain_identity.default[count.index].arn
  name     = var.policy_name
  policy   = data.aws_iam_policy_document.document.json
}
```
  • Loading branch information
agconti committed Jul 28, 2022
1 parent 8e0c49d commit 1ffc460
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ resource "aws_route53_record" "dkim" {
#Description : Terraform module to create domain mail from on AWS
resource "aws_ses_domain_mail_from" "default" {
count = var.enable_mail_from ? 1 : 0
domain = aws_ses_domain_identity.default.*.domain
domain = aws_ses_domain_identity.default[count.index].domain
mail_from_domain = local.stripped_mail_from_domain
}

Expand Down Expand Up @@ -145,7 +145,7 @@ data "aws_iam_policy_document" "document" {
#Description : Terraform module to create ses identity policy on AWS
resource "aws_ses_identity_policy" "default" {
count = var.enable_policy ? 1 : 0
identity = aws_ses_domain_identity.default.*.arn
identity = aws_ses_domain_identity.default[count.index].arn
name = var.policy_name
policy = data.aws_iam_policy_document.document.json
}
Expand Down

0 comments on commit 1ffc460

Please sign in to comment.