From 0dddb48239b688f70657827681e13b6c30defb32 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Tue, 4 Apr 2017 15:41:30 +0100 Subject: [PATCH] provider/aws: Improve logging & docs for caller_identity (#13316) --- .../providers/aws/data_source_aws_caller_identity.go | 11 ++--------- .../providers/aws/d/caller_identity.html.markdown | 4 ---- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/builtin/providers/aws/data_source_aws_caller_identity.go b/builtin/providers/aws/data_source_aws_caller_identity.go index 756bc9b52..a2adcef34 100644 --- a/builtin/providers/aws/data_source_aws_caller_identity.go +++ b/builtin/providers/aws/data_source_aws_caller_identity.go @@ -40,16 +40,9 @@ func dataSourceAwsCallerIdentityRead(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("Error getting Caller Identity: %v", err) } - log.Printf("[DEBUG] Reading Caller Identity.") + log.Printf("[DEBUG] Received Caller Identity: %s", res) + d.SetId(time.Now().UTC().String()) - - if *res.Account == "" { - log.Println("[DEBUG] No Account ID available, failing") - return fmt.Errorf("No AWS Account ID is available to the provider. Please ensure that\n" + - "skip_requesting_account_id is not set on the AWS provider.") - } - - log.Printf("[DEBUG] Setting AWS Account ID to %s.", *res.Account) d.Set("account_id", res.Account) d.Set("arn", res.Arn) d.Set("user_id", res.UserId) diff --git a/website/source/docs/providers/aws/d/caller_identity.html.markdown b/website/source/docs/providers/aws/d/caller_identity.html.markdown index fdcd41c65..5609a5b3f 100644 --- a/website/source/docs/providers/aws/d/caller_identity.html.markdown +++ b/website/source/docs/providers/aws/d/caller_identity.html.markdown @@ -12,10 +12,6 @@ description: |- Use this data source to get the access to the effective Account ID, User ID, and ARN in which Terraform is authorized. -~> **NOTE on `aws_caller_identity`:** - an Account ID is only available -if `skip_requesting_account_id` is not set on the AWS provider. In such -cases, the data source will return an error. - ## Example Usage ```