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

Duplicate object key on identity groups when service account name is the same #172

Open
brettcurtis opened this issue Dec 4, 2023 · 0 comments

Comments

@brettcurtis
Copy link
Contributor

╷
│ Error: Duplicate object key
│ 
│   on locals.tf line 71, in locals:
│   51:   owners = { for owner in flatten([
│   52:     # This will iterate over the identity_groups map and return a list of maps based of the values of the owners
│   53:     # that includes the group key.
│   54:     for identity_group_key, group in var.identity_groups : [
│   55:       for owner in group.owners : {
│   56:         group = identity_group_key
│   57:         owner = owner
│   58:         # Split Function
│   59:         # https://developer.hashicorp.com/terraform/language/functions/split
│   60:         # This will split the owner string into a list of strings based on the @ symbol.
│   61:         # We do this because the owner string is an email address and we want to use the
│   62:         # the group plus the first part of the email address as resource name key.
│   63:         owner_split = split("@", owner)
│   64:       }
│   65:     ]
│   66:   ]) : "${owner.group}-${owner.owner_split[0]}" => owner }
│     ├────────────────
│     │ owner.group is "backstage"
│     │ owner.owner_split[0] is "plt-backstage-github"
│ 
│ Two different items produced the key "backstage-plt-backstage-github" in this 'for' expression. If duplicates are expected, use the ellipsis (...) after the value expression
│ to enable grouping by key.
╵
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant