diff --git a/aws/resource_aws_iam_role_policy.go b/aws/resource_aws_iam_role_policy.go index 451e9211bf0..5ca6096f4f2 100644 --- a/aws/resource_aws_iam_role_policy.go +++ b/aws/resource_aws_iam_role_policy.go @@ -79,7 +79,7 @@ func resourceAwsIamRolePolicyPut(d *schema.ResourceData, meta interface{}) error } d.SetId(fmt.Sprintf("%s:%s", *request.RoleName, *request.PolicyName)) - return nil + return resourceAwsIamRolePolicyRead(d, meta) } func resourceAwsIamRolePolicyRead(d *schema.ResourceData, meta interface{}) error { diff --git a/aws/resource_aws_iam_role_policy_test.go b/aws/resource_aws_iam_role_policy_test.go index 32c2cd969f8..ef25b3f3e49 100644 --- a/aws/resource_aws_iam_role_policy_test.go +++ b/aws/resource_aws_iam_role_policy_test.go @@ -96,6 +96,7 @@ func TestAccAWSIAMRolePolicy_namePrefix(t *testing.T) { "aws_iam_role_policy.test", &rolePolicy1, ), + resource.TestCheckResourceAttrSet("aws_iam_role_policy.test", "name"), ), }, { @@ -107,6 +108,7 @@ func TestAccAWSIAMRolePolicy_namePrefix(t *testing.T) { &rolePolicy2, ), testAccCheckAWSIAMRolePolicyNameMatches(&rolePolicy1, &rolePolicy2), + resource.TestCheckResourceAttrSet("aws_iam_role_policy.test", "name"), ), }, }, @@ -131,6 +133,7 @@ func TestAccAWSIAMRolePolicy_generatedName(t *testing.T) { "aws_iam_role_policy.test", &rolePolicy1, ), + resource.TestCheckResourceAttrSet("aws_iam_role_policy.test", "name"), ), }, { @@ -142,6 +145,7 @@ func TestAccAWSIAMRolePolicy_generatedName(t *testing.T) { &rolePolicy2, ), testAccCheckAWSIAMRolePolicyNameMatches(&rolePolicy1, &rolePolicy2), + resource.TestCheckResourceAttrSet("aws_iam_role_policy.test", "name"), ), }, },