Skip to content

Commit

Permalink
r/aws_iam_user: Resolve merge conflict between #2940 and #2979
Browse files Browse the repository at this point in the history
  • Loading branch information
bflad committed Jan 16, 2018
2 parents 70e75e7 + f2a525b commit 306bfb7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion aws/resource_aws_iam_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func resourceAwsIamUserUpdate(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Error updating IAM User %s: %s", d.Id(), err)
}

d.SetId(*request.NewUserName)
d.SetId(nn.(string))
return resourceAwsIamUserRead(d, meta)
}
return nil
Expand Down
28 changes: 28 additions & 0 deletions aws/resource_aws_iam_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,34 @@ func TestAccAWSUser_basic(t *testing.T) {
})
}

func TestAccAWSUser_nameChange(t *testing.T) {
var conf iam.GetUserOutput

name1 := fmt.Sprintf("test-user-%d", acctest.RandInt())
name2 := fmt.Sprintf("test-user-%d", acctest.RandInt())
path := "/"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSUserDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSUserConfig(name1, path),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSUserExists("aws_iam_user.user", &conf),
),
},
{
Config: testAccAWSUserConfig(name2, path),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSUserExists("aws_iam_user.user", &conf),
),
},
},
})
}

func testAccCheckAWSUserDestroy(s *terraform.State) error {
iamconn := testAccProvider.Meta().(*AWSClient).iamconn

Expand Down

0 comments on commit 306bfb7

Please sign in to comment.