If I need the Output<string> property from a...
# getting-started
p
If I need the Output<string> property from an object (in my case an UserAssignedIdentity object) - how exactly should I get that? There is no .Apply() for the object itself and Apply(x => x.ToString()) for the property itself doesn't seem to do anything.
m
Hi John, on which resource and provider?
p
UserAssignedIdentity in AzureNative: Pulumi.AzureNative.ManagedIdentity.UserAssignedIdentity
I need the "Id" and "ClientId" values of the object to pass into a kubernetes ConfigMap
I also tried to pass in the Output<string> into the ConfigMap and setting CustomResourceOptions.DependsOn to add dependency on the UserAssignedIdentity but that didn't seem to do the trick either. I assume I haven't fully grasped the Input/Output concept of Pulumi yet :/
I was able to get the values by calling: Pulumi.AzureNative.ManagedIdentity.GetUserAssignedIdentity(args).Result But this seems to separately query the object after creation (so I had to remove the auto-naming to be able to query for it). Is this the correct way to do it?
Okay... it appears like Apply() actually also produces an Output so I got it working by doing this:
Copy code
string theActualOutput = string.Empty;
var testing = managedIdentity.ClientId.Apply(x => theActualOutput = x);
Is that the proper way of doing it?
m
I do in go this on a managed identitiy
Copy code
identityMap := identity.ID().ToIDOutput().ToStringOutput().ApplyT(func(v string) map[string]interface{} {
			m := make(map[string]interface{})
			m[v] = pulumi.ToStringMap(map[string]string{})
			return m
		}).(pulumi.MapOutput)
In this case I needed to create an Identity map of the id
So had to run
ToIDOutput().ToStringOutput()
on the ID() to then call
ApplyT
p
Oh, okay. That looks even more complex than the c# solution, but I guess there's probably differences in the APIs. But you also have to return the value from within the apply() as you're defining a new function in there, so that part seems to be the same.
m
Yes I think so, the idea is the same
p
I learned something new. Thanks a lot for helping out!
m
np, you are welcome!