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

agreeable-whale-35898

09/28/2022, 5:52 PM
I couldn't find how to get the user name (the name of the entity who executed the
pulumi up
command, namely the CLI identity..) I found
GetCallerIdentity.InvokeAsync().GetAwaiter().GetResult().UserId
, but couldn't find the actual user's name. I want to add a transformation that adds a
by
tag with the executor name. Any idea how to do so in C# and AWS?
s

steep-toddler-94095

09/28/2022, 6:21 PM
does anything show up with the
Arn
property? sometimes the caller is an assumed role instead of an AWS user so wondering if that's why
UserId
is blank
a

agreeable-whale-35898

09/28/2022, 6:23 PM
UserId
isn't blank - it's a 21-alphanumeric-chars (all upper letters)
s

steep-toddler-94095

09/28/2022, 8:15 PM
oh i see. perhaps you can extract the username from the
Arn
assuming that has the user's Arn? If not you'll need to do a lookup of the AWS User using the UserId and get the name that way. Pulumi's
GetUser
function unfortunately only takes a Username, not the canonical UserId, so you might need to use a non-Pulumi AWS SDK to do this
a

agreeable-whale-35898

09/29/2022, 8:16 AM
I see. Ok,
Arn
it is, then 🙂 thanks!
p 1
2 Views