keep getting [Object object] collisions
# general
o
keep getting [Object object] collisions
c
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
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
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
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
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
ok
thanks Luke