Hello all, I’m trying to create a service account...
# golang
m
Hello all, I’m trying to create a service account (GCP) and attach an IAM policy to it. Considering the following snippet:
Copy code
sa, err := serviceaccount.NewAccount(ctx, s.Name, &serviceaccount.AccountArgs{
			AccountId:   pulumi.String(s.Id),
			DisplayName: pulumi.String("A service account for my app"),
		})
		if err != nil {
			return err
		}

		fmt.Println("Service account email: ", sa.Email)
		storageAdmin, err := organizations.LookupIAMPolicy(ctx, &organizations.LookupIAMPolicyArgs{
			Bindings: []organizations.GetIAMPolicyBinding{
				organizations.GetIAMPolicyBinding{
					Role: "roles/compute.storageAdmin",
					Members: []string{
						sa.Email,
					},
				},
			},
		}, nil)
2 questions here: • Can I rely on using
sa.Email
after calling
serviceaccount.NewAccount
? Or does that run asynchronously and populate
sa
with promise-like values? • If I can use
sa.Email
where I have it, how do I convert this
pulumi.StringOutput
to
String
?