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

A resource with the same resourceName but a different internalId already exists #138

Open
victor-keltio opened this issue Apr 6, 2023 · 0 comments

Comments

@victor-keltio
Copy link

victor-keltio commented Apr 6, 2023

Hey there. First, I would like to thank you for your work. :)

Describe the bug

Using v6.0.0 and Terraform v1.4.4.

Applying the module works successfully, but it ignores the tags defined by the AWS provider.
When applying again, Terraform wants to add them, and then the bug occurs:

$ terraform apply
aws_route53_record.txt_dmarc[0]: Refreshing state... [id=<ID>__dmarc.<domain>_TXT]
data.aws_region.current: Reading...
aws_sesv2_email_identity.main: Refreshing state... [id=<domain>]
data.aws_region.current: Read complete after 0s [id=<region>]
aws_route53_record.dkim[1]: Refreshing state... [id=<id>._domainkey_CNAME]
aws_sesv2_email_identity_mail_from_attributes.main: Refreshing state... [id=<domain>]
aws_route53_record.dkim[0]: Refreshing state... [id=<id>._domainkey_CNAME]
aws_route53_record.dkim[2]: Refreshing state... [id=<id>._domainkey_CNAME]
aws_route53_record.mx_send_mail_from: Refreshing state... [id=<id>_mail.<domain>_MX]
aws_route53_record.spf_mail_from[0]: Refreshing state... [id=<id>_mail.<domain>_TXT]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_sesv2_email_identity.main will be updated in-place
  ~ resource "aws_sesv2_email_identity" "main" {
        id                          = "<domain>"
        tags                        = {}
      ~ tags_all                    = {
          + "ENVIRONMENT" = "env"
          + "CREATOR"   = "terraform"
        }
        # (4 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_sesv2_email_identity.main: Modifying... [id=<domain>]
╷
│ Error: updating Amazon SESv2 (Simple Email V2) Email Identity (<domain>): tagging resource (arn:aws:ses:<region>:<account>:identity/<domain>): operation error SESv2: TagResource, https response error StatusCode: 400, RequestID: <id>, BadRequestException: A resource with the same resourceName but a different internalId already exists: <id>
│
│   with aws_sesv2_email_identity.main,
│   on main.tf line 14, in resource "aws_sesv2_email_identity" "main":
│   14: resource "aws_sesv2_email_identity" "main" {
│

To Reproduce

Steps to reproduce the behavior:

  1. Add default_tags to the AWS provider in the Terraform file
  2. Apply the configuration
  3. The tags are not present
  4. Apply again
  5. Terraform detects the missing tags
  6. Error occurs

Expected behavior
By default, the tags should be present during the first apply, and in a second time, Terraform shouldn't consider that the resource isn't the one it created.

Additional context
I'm using this module with Terragrunt, a Terraform wrapper.

I tried destroying everything and applying again, it works perfectly but the tags are missing.

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

No branches or pull requests

1 participant