https://pulumi.com logo
Title
a

adventurous-television-3865

09/20/2022, 4:50 PM
Hello! I’m new to Pulumi (and TS) and am struggling with something that I think should be fairly straight forward. Scenario: I have existing users and groups in an Azure AD. I would like to programmatically manage certain groups. I have a github admins group where the owners are the platform team, but the members should also include an additional user (Director of Development). I can’t for the life of me figure out how to concat two groups together in a way that TS likes for this object. Code to come in a moment.
I’ve tried several permutations to pull these together. Under the TS they’re just a list of object IDs, but I’m struggling to get them out of the nested Pulumi stuff.
Any help would be greatly appreciated
b

billowy-army-68599

09/20/2022, 5:10 PM
@adventurous-television-3865 this doesn’t answer your question, but I think the easier way to do this is:
const githubAdminsGroup = new azuread.Group("github-admins", {
  displayName: "github-admins",
  owners: sourcePlatformGroup.members,
  securityEnabled: true,
});

const exampleGroupMember = new azuread.GroupMember("githubMembers", {
    groupObjectId: githubAdminsGroup.id,
    memberObjectId: // add member objects for each user here,
});
👍 1
:thank-you: 1
a

adventurous-television-3865

09/20/2022, 5:29 PM
Thanks for the suggestion. I think I’m going to take that approach as well, but I’m still going to have the issue of having to merge the two lists of object IDs.
b

billowy-army-68599

09/20/2022, 6:08 PM
you can merge the two lists inside a promise resolution (or a pulumi output resolution) - the real problem is that you then have to do things like create resources inside the
.then
or the
apply
l

little-cartoon-10569

09/20/2022, 8:05 PM
Is
members
an Output<array> of Output<string>s (ids)? You may be able to use
members: pulumi.all([array1, array2])
  .apply(([a1,  a2]) => [...a1, ...a2]);
This won't work if the type of members isn't
Output<Output<string>[]>
or similarl.
a

adventurous-television-3865

09/21/2022, 12:40 AM
thank you both! I will try those tomorrow!