1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. getCallerIdentity
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.getCallerIdentity

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

This data source provides the identity of the current user.

NOTE: Available in 1.65.0+.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const current = alicloud.getCallerIdentity({});
export const currentUserArn = current.then(current => current.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

current = alicloud.get_caller_identity()
pulumi.export("currentUserArn", current.id)
Copy
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, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		ctx.Export("currentUserArn", current.Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var current = AliCloud.GetCallerIdentity.Invoke();

    return new Dictionary<string, object?>
    {
        ["currentUserArn"] = current.Apply(getCallerIdentityResult => getCallerIdentityResult.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.AlicloudFunctions;
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 current = AlicloudFunctions.getCallerIdentity();

        ctx.export("currentUserArn", current.applyValue(getCallerIdentityResult -> getCallerIdentityResult.id()));
    }
}
Copy
variables:
  current:
    fn::invoke:
      function: alicloud:getCallerIdentity
      arguments: {}
outputs:
  currentUserArn: ${current.id}
Copy

Using getCallerIdentity

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

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

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

public static class GetCallerIdentity 
{
    public static Task<GetCallerIdentityResult> InvokeAsync(InvokeOptions? opts = null)
    public static Output<GetCallerIdentityResult> Invoke(InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetCallerIdentityResult> getCallerIdentity(InvokeOptions options)
public static Output<GetCallerIdentityResult> getCallerIdentity(InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:index/getCallerIdentity:getCallerIdentity
  arguments:
    # arguments dictionary
Copy

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.
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.
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.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi