Skip to content

Commit

Permalink
try and fix group membership (#10)
Browse files Browse the repository at this point in the history
* test adding groups and memberships

* fix syntax

* add back in data block

* fix syntax

* add group changes

* remove duplicate resource group

* test chatgpt code

* try and fix group assocation

* bad

* add in daily commit

* update readme

* try and fix group membership

* make users belong to one group

* change variable type in users object

* remove string brackets

* try and fix group membership

* undo type change

* try and fix userid error
  • Loading branch information
zachrundle authored Aug 25, 2024
1 parent b876b00 commit 58e791a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ A module that will configure an EKS cluster and the required IAM role and permis
### Spot Fleet
A module to configure spot fleets and acceptable spot server types that can be used with the EKS module. A future enhancement will be to also leverage Karpenter to help with autoscaling.


### VPC
A module that will configure the VPC and subnets (based on the amount of AZs in that region). Also has an option to configure a NAT gateway.

4 changes: 2 additions & 2 deletions modules/iam_identity_users/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ resource "aws_identitystore_user" "this" {
resource "aws_identitystore_group_membership" "this" {
for_each = var.users
identity_store_id = tolist(data.aws_ssoadmin_instances.this.identity_store_ids)[0]
group_id = aws_identitystore_group.this[each.value.group].id
member_id = aws_identitystore_user.this[each.key].id
group_id = aws_identitystore_group.this[each.value.groups].id
member_id = aws_identitystore_user.this[each.key].user_id
}
3 changes: 2 additions & 1 deletion modules/iam_identity_users/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ variable "users" {
type = map(object({
first_name = string
last_name = string
groups = set(string) # Set of group names the user belongs to
# TODO: add support in case a user needs to belong to multiple groups
groups = string
}))
}

Expand Down
6 changes: 3 additions & 3 deletions users.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module "users" {
source = "./modules/iam_identity_users"
groups = ["administrators", "developers", "qa", "networking"]
groups = ["administrators", "developers", "networking"]

users = {
"Zach Rundle" = {
first_name = "Zach"
last_name = "Rundle"
groups = ["administrators"]
groups = "administrators"
},
"Maverick Dog" = {
first_name = "Maverick"
last_name = "Dog"
groups = ["developers", "qa"]
groups = "developers"
},
}
}

0 comments on commit 58e791a

Please sign in to comment.