https://pulumi.com logo
#aws
Title
q

quaint-electrician-41503

10/13/2020, 4:24 AM
I'm trying to use https://www.pulumi.com/docs/reference/pkg/aws/iam/rolepolicyattachment/ and I only have a library the exports a role arn vs a role. Any ideas how I can do this or do I have to go back to the library provider and ask them to export the role?
l

little-cartoon-10569

10/13/2020, 4:27 AM
The
role
parameter can take the role as a string. Guessing from the Terraform equivalent, that this is the name of the role. The name of the role can be parsed out of the ARN, it's everything from "role/" to the end...
q

quaint-electrician-41503

10/13/2020, 4:28 AM
Yeah, it seems pretty terrible that I would have to parse the name out of the arn.
Then maybe I use https://www.pulumi.com/docs/reference/pkg/aws/getarn/ and try to figure out what part I need...
👍 1
l

little-cartoon-10569

10/13/2020, 4:30 AM
If it's easier than getting another party to update their code? You can't even use Role.get, since it needs an id and a name... 🙄
q

quaint-electrician-41503

10/13/2020, 4:30 AM
It's probably easier than asking them to change their code. I have to do it now.
l

little-cartoon-10569

10/13/2020, 4:31 AM
It's the "resource" part of the arn. It will be "role/<rolename>".
q

quaint-electrician-41503

10/13/2020, 4:32 AM
Thanks @little-cartoon-10569!
👍 1
Looks like I still need to drop the pulumi -23498 off the end. Maybe I just had an instance vs a role.
It will be the argument to get them to change their code
Wasn't able to make any of it work so far...
the resource didn't work, the resource with -39845 removed didn't work. I was about to beat around the bush with trying to use Role.get() with the resource() but I think it's sort of evident it's likely not going to work
looks like my bad. You need to remove the role/ in front of the string. Removing the trailing instance will not work. Thanks again.
l

little-cartoon-10569

10/13/2020, 6:19 AM
Yep, the "role/" isn't part of the name.