getCallerIdentity

This data source provides the identity of the current user.

NOTE: Available in 1.65.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var current = Output.Create(AliCloud.GetCallerIdentity.InvokeAsync());
        this.CurrentUserArn = current.Apply(current => current.Id);
    }

    [Output("currentUserArn")]
    public Output<string> CurrentUserArn { get; set; }
}
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := alicloud.GetCallerIdentity(ctx, nil, nil)
		if err != nil {
			return err
		}
		ctx.Export("currentUserArn", current.Id)
		return nil
	})
}
import pulumi
import pulumi_alicloud as alicloud

current = alicloud.get_caller_identity()
pulumi.export("currentUserArn", current.id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const current = pulumi.output(alicloud.getCallerIdentity({ async: true }));

export const currentUserArn = current.id;

Using getCallerIdentity

function getCallerIdentity(opts?: InvokeOptions): Promise<GetCallerIdentityResult>
def get_caller_identity(opts: Optional[InvokeOptions] = None) -> GetCallerIdentityResult
func GetCallerIdentity(ctx *Context, opts ...InvokeOption) (*GetCallerIdentityResult, error)

Note: This function is named GetCallerIdentity in the Go SDK.

public static class GetCallerIdentity {
    public static Task<GetCallerIdentityResult> InvokeAsync(InvokeOptions? opts = null)
}

getCallerIdentity Result

The following output properties are available:

AccountId string
Account ID.
Arn string
The Alibaba Cloud Resource Name (ARN) of the user making the call.
Id string
The provider-assigned unique ID for this managed resource.
IdentityType string
The type of the princiapal. RAMUser for users.
AccountId string
Account ID.
Arn string
The Alibaba Cloud Resource Name (ARN) of the user making the call.
Id string
The provider-assigned unique ID for this managed resource.
IdentityType string
The type of the princiapal. RAMUser for users.
accountId string
Account ID.
arn string
The Alibaba Cloud Resource Name (ARN) of the user making the call.
id string
The provider-assigned unique ID for this managed resource.
identityType string
The type of the princiapal. RAMUser for users.
account_id str
Account ID.
arn str
The Alibaba Cloud Resource Name (ARN) of the user making the call.
id str
The provider-assigned unique ID for this managed resource.
identity_type str
The type of the princiapal. RAMUser for users.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.