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

fix(main): update domain references to use count #17

Merged
merged 1 commit into from
Jul 28, 2022

Conversation

agconti
Copy link
Contributor

@agconti agconti commented Jul 22, 2022

what

Fixes:

| Error: Incorrect attribute value type
│ 
│   on .terraform/modules/example_ses/main.tf line 66, in resource "aws_ses_domain_mail_from" "default":
│   66:   domain           = aws_ses_domain_identity.default.*.domain
│     ├────────────────
│     │ aws_ses_domain_identity.default is tuple with 1 element
│ 
│ Inappropriate value for attribute "domain": string required.

Previously:

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.

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
}

why

  • The module cannot be applied without this change.

references

Closes clouddrove#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
}
```
@anmolnagpal anmolnagpal merged commit 1ffc460 into clouddrove:master Jul 28, 2022
@anmolnagpal
Copy link
Contributor

Thanks @agconti

@cdhesse
Copy link

cdhesse commented Oct 10, 2022

You need to do a release 1.0.2 for this to be usable!

@WhiteDiamondz
Copy link

Any chance a new release is posible to integrate this fix @anmolnagpal ?

@anmolnagpal
Copy link
Contributor

@cdhesse @WhiteDiamondz New Release has been created.

@WhiteDiamondz
Copy link

@cdhesse @WhiteDiamondz New Release has been created.

That's great to hear, thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_ses_domain_identity.default is tuple with 1 element
4 participants