Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.34.0 published on Wednesday, Aug 17, 2022 by Pulumi

getClientOpenIdUserInfo

Get OpenID userinfo about the credentials used with the Google provider, specifically the email.

This datasource enables you to export the email of the account you’ve authenticated the provider with; this can be used alongside data.google_client_config’s access_token to perform OpenID Connect authentication with GKE and configure an RBAC role for the email used.

This resource will only work as expected if the provider is configured to use the https://www.googleapis.com/auth/userinfo.email scope! You will receive an error otherwise. The provider uses this scope by default.

Example Usage

Exporting An Email

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var me = Gcp.Organizations.GetClientOpenIdUserInfo.Invoke();

    return new Dictionary<string, object?>
    {
        ["my-email"] = me.Apply(getClientOpenIdUserInfoResult => getClientOpenIdUserInfoResult.Email),
    };
});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		me, err := organizations.GetClientOpenIdUserInfo(ctx, nil, nil)
		if err != nil {
			return err
		}
		ctx.Export("my-email", me.Email)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var me = OrganizationsFunctions.getClientOpenIdUserInfo();

        ctx.export("my-email", me.applyValue(getClientOpenIdUserInfoResult -> getClientOpenIdUserInfoResult.email()));
    }
}
import pulumi
import pulumi_gcp as gcp

me = gcp.organizations.get_client_open_id_user_info()
pulumi.export("my-email", me.email)
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

export = async () => {
    const me = await gcp.organizations.getClientOpenIdUserInfo({});
    const my_email = me.email;
    return {
        "my-email": my_email,
    };
}
variables:
  me:
    Fn::Invoke:
      Function: gcp:organizations:getClientOpenIdUserInfo
      Arguments: {}
outputs:
  my-email: ${me.email}

Using getClientOpenIdUserInfo

function getClientOpenIdUserInfo(opts?: InvokeOptions): Promise<GetClientOpenIdUserInfoResult>
def get_client_open_id_user_info(opts: Optional[InvokeOptions] = None) -> GetClientOpenIdUserInfoResult
func GetClientOpenIdUserInfo(ctx *Context, opts ...InvokeOption) (*GetClientOpenIdUserInfoResult, error)

> Note: This function is named GetClientOpenIdUserInfo in the Go SDK.

public static class GetClientOpenIdUserInfo 
{
    public static Task<GetClientOpenIdUserInfoResult> InvokeAsync(InvokeOptions? opts = null)
}
public static CompletableFuture<GetClientOpenIdUserInfoResult> getClientOpenIdUserInfo(InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:organizations/getClientOpenIdUserInfo:getClientOpenIdUserInfo
  Arguments:
    # Arguments dictionary

getClientOpenIdUserInfo Result

The following output properties are available:

Email string

The email of the account used by the provider to authenticate with GCP.

Id string

The provider-assigned unique ID for this managed resource.

Email string

The email of the account used by the provider to authenticate with GCP.

Id string

The provider-assigned unique ID for this managed resource.

email String

The email of the account used by the provider to authenticate with GCP.

id String

The provider-assigned unique ID for this managed resource.

email string

The email of the account used by the provider to authenticate with GCP.

id string

The provider-assigned unique ID for this managed resource.

email str

The email of the account used by the provider to authenticate with GCP.

id str

The provider-assigned unique ID for this managed resource.

email String

The email of the account used by the provider to authenticate with GCP.

id String

The provider-assigned unique ID for this managed resource.

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.