https://pulumi.com logo
s

salmon-ghost-86211

03/22/2021, 10:14 PM
Using AWS EKS and Typescript. Is there any way to enumerate a list of IAM users from an existing IAM group? I can use the 
aws.iam.Group.get
 method to get the group, but I'm not sure how to actually access the existing group membership. The ultimate goal is to pull in a list of users to apply specific RBAC permissions to. Is there a better way?
b

brave-planet-10645

03/23/2021, 10:22 AM
You can use the
getGroup()
method which returns details of the group but also the users in the group:
Copy code
const group = aws.iam.getGroup({
    groupName: "groupname"
})

export const users = group.then(x => x.users);
s

salmon-ghost-86211

03/23/2021, 4:33 PM
That worked! Thank you. I wonder why there is both a
get
method AND a
getGroup
method. When would I use only
get
?
Actually user tenwit explained
get
 is a Pulumi object that loads a Pulumi group object. It isn't often useful, but occasionally you want to have a Pulumi object managed in one Project/stack, and used in a different one. This is the method that allows that.
getGroup
 is a wrapper around the AWS SDK getGroup function. It doesn't return a Pulumi object, it returns a GetGroupResult. It's handy for when you want information about an object that isn't managed by Pulumi, as in this case.
4 Views