How am I supposed to handle a case where I need a ...
# golang
How am I supposed to handle a case where I need a resource attribute as a string? I've got a GCP project resource and want the default service account
Copy code
p := organizations.NewProject(ctx, "p", &organizations.ProjectArgs{
			ProjectId:      pulumi.Sprintf("%s-%s", petName.ID(), ctx.Stack()),
		sa, err := compute.GetDefaultServiceAccount(ctx, &compute.GetDefaultServiceAccountArgs{
			Project: &p.Name, // Project is a *string
but this clearly yields type error
cannot use p.Name (variable of type pulumi.StringOutput) as *string value in struct literal
. Reading docs I've not been able to find the way to achieve this using either apply, lifting or interpolation.
Gets/Invokes are typically synchronous in the pulumi provider SKDs. This means that outputs wont be compatible. So to you output values with a sync invoke/get you'll need to unwrap the outputs via
something like:
Copy code
// do the GetDefaultServiceAcc call here
Whatever you return from that call will be a new output. Note that it's not advised to create resources from within applies as this can break the dependency graph, but reading like this should be fine.
Ah, I see that makes sense. I did not know that they were synchronous. Thanks!