provider/aws: Improve logging & docs for caller_identity (#13316)

This commit is contained in:
Radek Simko 2017-04-04 15:41:30 +01:00 committed by GitHub
parent 8e470fc01c
commit 0dddb48239
2 changed files with 2 additions and 13 deletions

View File

@ -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)

View File

@ -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
```