https://pulumi.com logo
#general
Title
# general
o

orange-tailor-85423

02/08/2019, 11:14 PM
keep getting [Object object] collisions
c

creamy-potato-29402

02/08/2019, 11:19 PM
hmm, not sure I understand the question
is the problem that you can’t write such a function at all, or that it’s not clear how to do it reliably
o

orange-tailor-85423

02/08/2019, 11:31 PM
how to do it reliably
I create 2 service accounts
pass an array of their emails to a function that uses them to assign those 2 accounts to the same role.
w

white-balloon-205

02/08/2019, 11:33 PM
It sounds like you are likely trying to use an
Output<T>
as a
name
parameter on a resource. That won’t work, and you will need to pick a name that is known up front (before the resource ultimately gets created). You can generally do this by passing a name into the code that is creating these resources, and ensuring that callers pass both the name and any `output`s that are need to initialize it. If you have code you could share, we could give more precise guidance.
o

orange-tailor-85423

02/08/2019, 11:35 PM
export function createIamMemberFromServiceAccount( roles: string[], members: Input<string>[], project: string ) { roles.forEach(role => { members.forEach(sa => { new gcp.projects.IAMMember(
${project}:${role}:${sa}
, { member: pulumi.concat("serviceAccount:", sa), project, role }); }); }); }
ok - i guess that's the issue
the account name is computed
w

white-balloon-205

02/08/2019, 11:39 PM
That’s right - the
sa
part will tostring to
[object Object]
which will not work. Suggest that callers of this pass in an explicit member name, or use the loop index instead of the Output as part of the name.
o

orange-tailor-85423

02/08/2019, 11:42 PM
ok
thanks Luke