Difference between revisions of "Data source: aws caller identity"

From wikieduonline
Jump to navigation Jump to search
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
*<code>aws_caller_identity</code> <ref>https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity</ref>
+
[[Terraform AWS data sources|AWS data source]]: <code>aws_caller_identity</code>  
 +
* https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity
 +
Use this data source to get the access to the effective [[Account ID]], [[User ID]], and [[ARN]] in which Terraform is authorized.
  
 
==Example==
 
==Example==
Line 6: Line 8:
 
  data "aws_caller_identity" "current" {}
 
  data "aws_caller_identity" "current" {}
 
   
 
   
  output "[[account_id]]" {
+
  [[output]] "[[account_id]]" {
   value = data.aws_caller_identity.current.account_id
+
   value = data.aws_caller_identity.current.[[account_id]]
 
  }
 
  }
 
   
 
   
Line 15: Line 17:
 
   
 
   
 
  output "[[caller_user]]" {
 
  output "[[caller_user]]" {
   value = data.aws_caller_identity.current.user_id
+
   value = data.aws_caller_identity.current.[[user_id]]
 
  }
 
  }
  
 
== Related terms ==
 
== Related terms ==
 
* [[Data source]]
 
* [[Data source]]
 +
* <code>[[aws sts get-caller-identity]]</code>
 +
* <code>[[terraform show]]</code>
 +
* <code>[[error: You must be logged in to the server (Unauthorized)]]</code>
 +
* <code>[[module.eks.module.kms.data.aws_caller_identity.current]]</code>
  
 
== See also ==
 
== See also ==
 +
* {{terraform data sources}}
 
* {{terraform aws resources}}
 
* {{terraform aws resources}}
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]
 
[[Category:AWS]]
 
[[Category:AWS]]

Latest revision as of 08:57, 11 July 2024

AWS data source: aws_caller_identity

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

Example[edit]

There is no arguments for this data source:

data "aws_caller_identity" "current" {}

output "account_id" {
  value = data.aws_caller_identity.current.account_id
}

output "caller_arn" {
  value = data.aws_caller_identity.current.arn
}

output "caller_user" {
  value = data.aws_caller_identity.current.user_id
}

Related terms[edit]

See also[edit]

Advertising: