From 04214c8c1a82a9476c41fda431f18d96769f8db2 Mon Sep 17 00:00:00 2001 From: John Engelman Date: Mon, 11 May 2015 10:32:06 -0500 Subject: [PATCH] Closes #1908. Parse AccountId from User ARN for RDS tags --- builtin/providers/aws/resource_aws_db_instance.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_db_instance.go b/builtin/providers/aws/resource_aws_db_instance.go index addc4c168e..f47d8abbea 100644 --- a/builtin/providers/aws/resource_aws_db_instance.go +++ b/builtin/providers/aws/resource_aws_db_instance.go @@ -3,6 +3,7 @@ package aws import ( "fmt" "log" + "strings" "time" "github.com/awslabs/aws-sdk-go/aws" @@ -572,7 +573,8 @@ func buildRDSARN(d *schema.ResourceData, meta interface{}) (string, error) { if err != nil { return "", err } - user := resp.User - arn := fmt.Sprintf("arn:aws:rds:%s:%s:db:%s", region, *user.UserID, d.Id()) + userARN := *resp.User.ARN + accountID := strings.Split(userARN, ":")[4] + arn := fmt.Sprintf("arn:aws:rds:%s:%s:db:%s", region, accountID, d.Id()) return arn, nil }