diff --git a/builtin/providers/aws/resource_aws_iam_policy_attachment_test.go b/builtin/providers/aws/resource_aws_iam_policy_attachment_test.go index 97da2b909..e2e9c2a8e 100644 --- a/builtin/providers/aws/resource_aws_iam_policy_attachment_test.go +++ b/builtin/providers/aws/resource_aws_iam_policy_attachment_test.go @@ -6,7 +6,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/iam" - randomprovider "github.com/hashicorp/terraform/builtin/providers/random" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" @@ -44,17 +43,15 @@ func TestAccAWSPolicyAttachment_basic(t *testing.T) { func TestAccAWSPolicyAttachment_paginatedEntities(t *testing.T) { var out iam.ListEntitiesForPolicyOutput + rInt := acctest.RandInt() resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: map[string]terraform.ResourceProvider{ - "aws": testAccProvider, - "random": randomprovider.Provider(), - }, + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, CheckDestroy: testAccCheckAWSPolicyAttachmentDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccAWSPolicyPaginatedAttachConfig, + Config: testAccAWSPolicyPaginatedAttachConfig(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckAWSPolicyAttachmentExists("aws_iam_policy_attachment.test-paginated-attach", 101, &out), ), @@ -306,38 +303,33 @@ resource "aws_iam_policy_attachment" "test-attach" { }`, u1, u2, u3) } -const testAccAWSPolicyPaginatedAttachConfig = ` -resource "random_id" "user_id" { - byte_length = 10 -} - +func testAccAWSPolicyPaginatedAttachConfig(rInt int) string { + return fmt.Sprintf(` resource "aws_iam_user" "user" { - count = 101 - name = "${format("paged-test-user-${random_id.user_id.hex}-%d", count.index + 1)}" + count = 101 + name = "${format("paged-test-user-%d-%%d", count.index + 1)}" } - resource "aws_iam_policy" "policy" { - name = "test-policy" - description = "A test policy" - policy = <