Skip to content

Data Source: awsCallerIdentity

Use this data source to get the access to the effective Account ID, User ID, and ARN in which Terraform is authorized.

Example Usage

import * as cdktf from "cdktf";
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsCallerIdentityCurrent =
  new aws.dataAwsCallerIdentity.DataAwsCallerIdentity(this, "current", {});
new cdktf.TerraformOutput(this, "account_id", {
  value: dataAwsCallerIdentityCurrent.accountId,
});
new cdktf.TerraformOutput(this, "caller_arn", {
  value: dataAwsCallerIdentityCurrent.arn,
});
new cdktf.TerraformOutput(this, "caller_user", {
  value: dataAwsCallerIdentityCurrent.userId,
});

Argument Reference

There are no arguments available for this data source.

Attributes Reference

  • accountId - AWS Account ID number of the account that owns or contains the calling entity.
  • arn - ARN associated with the calling entity.
  • id - Account ID number of the account that owns or contains the calling entity.
  • userId - Unique identifier of the calling entity.