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

Error when AWS Org has 2 Accounts with duplicate name #48

Open
RW-LGC opened this issue Sep 20, 2024 · 0 comments
Open

Error when AWS Org has 2 Accounts with duplicate name #48

RW-LGC opened this issue Sep 20, 2024 · 0 comments

Comments

@RW-LGC
Copy link

RW-LGC commented Sep 20, 2024

I tested the SSO Module in a test AWS Orgnization which had 2 AWS Accounts with the same name, both were called Development, yet seperate accounts.

As AWS does not protect against this, it seems a rare but possible scenario. When I run terraform plan the issue presents itself like so;

│ Error: Duplicate object key
│ 
│   on .terraform/modules/aws-iam-identity-center/locals.tf line 127, in locals:
│  126:   accounts_ids_maps = {
│  127:     for idx, account in data.aws_organizations_organization.organization.accounts : account.name => account.id
│  128:     if account.status == "ACTIVE" && can(data.aws_organizations_organization.organization.accounts)
│  129:   }
│     ├────────────────
│     │ account.name is "Development"
│ 
│ Two different items produced the key "Development" in this 'for' expression. If duplicates are
│ expected, use the ellipsis (...) after the value expression to enable grouping by key.

Is it possible to account for this at the module level?
Regards

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