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

orange-tailor-85423

02/06/2019, 1:50 AM
g

gentle-diamond-70147

02/06/2019, 1:54 AM
given the
[object Object]
in the error, I think you need to tell Pulumi to transform the sa's outputs to the new string
e.g.
Copy code
pulumi.interpolate`${project}:${role}:${sa.email}`
and
Copy code
pulumi.interpolate`serviceAccount:${sa.email}`
o

orange-tailor-85423

02/06/2019, 2:01 AM
where do I run the transform - doesn't like it inline
g

gentle-diamond-70147

02/06/2019, 2:04 AM
no? I've used it inline a lot I think. 😕
it's a relatively new addition to pulumi - in 0.16.11 a couple weeks ago in case you're on a version older than that
o

orange-tailor-85423

02/06/2019, 2:04 AM
I'm on 0.16.12
see photo
g

gentle-diamond-70147

02/06/2019, 2:33 AM
I see. Trying some things... brb
So the issue is that the resource name requires a
string
all other arguments require
pulumi.Input<String>
. Pulumi needs the resource name "early" to ensure uniqueness so it can't depend on any
Output
values.
so using
pulumi.interpolate...
on the
member
value will work
but we'll need to compose an actual string for the resource name
so something like this :
Copy code
typescript
export function createIamMemberFromServiceAccount(
    roles: string[],
    members: gcp.serviceAccount.Account[],
    project: string
) {
    roles.forEach(role => {
        members.forEach((sa, idx) => {
            new gcp.projects.IAMMember(`${project}:${role}-${idx}`, {
                member: pulumi.interpolate`serviceAccount:${sa.email}`,
                project,
                role
            });
        });
    });
}
from what I can tell, the name for an IAMMember only matters for Pulumi's needs, not GCP's. GCP never sees it.
Was that able to work for you?