-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify code in group_membership.tf by restructuring the users variable
- Loading branch information
Showing
3 changed files
with
6 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
# Put assessment provisioner users in the appropriate group. | ||
resource "aws_iam_user_group_membership" "assessment_provisioners" { | ||
provider = aws.users | ||
for_each = toset([for user in var.users : user.name]) | ||
for_each = var.users | ||
|
||
groups = [ | ||
# This is yucky, but I don't know how else to deal with a list of | ||
# maps in Terraform. | ||
[for user in var.users : user.backend_access if user.name == each.value][0] ? aws_iam_group.assessment_provisioners.name : aws_iam_group.assessment_provisioners_no_backend.name | ||
each.value.backend_access ? aws_iam_group.assessment_provisioners.name : aws_iam_group.assessment_provisioners_no_backend.name | ||
] | ||
user = each.value | ||
user = each.key | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters