Skip to content

Commit

Permalink
Merge pull request #6 from mineiros-io/mariux/fix-user-group-assignme…
Browse files Browse the repository at this point in the history
…nt-on-empty-groups

Fix a bug that created group membership resources for empty groups
  • Loading branch information
mariux authored May 25, 2020
2 parents 78f04c7 + 2273f56 commit ff0b5e0
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 @@ -93,9 +93,9 @@ resource "aws_iam_user_policy_attachment" "policy" {
]
}

# add the user to a list of groups
# add the user to a list of groups if groups are defined
resource "aws_iam_user_group_membership" "group" {
for_each = var.module_enabled ? var.names : []
for_each = var.module_enabled && length(var.groups) > 0 ? var.names : []

user = aws_iam_user.user[each.key].name
groups = var.groups
Expand Down

0 comments on commit ff0b5e0

Please sign in to comment.