add randomness to iam policy attachments
This commit is contained in:
parent
c06c17c914
commit
0aa9d71f7f
|
@ -6,6 +6,7 @@ import (
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/iam"
|
"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/acctest"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
|
@ -46,7 +47,10 @@ func TestAccAWSPolicyAttachment_paginatedEntities(t *testing.T) {
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: map[string]terraform.ResourceProvider{
|
||||||
|
"aws": testAccProvider,
|
||||||
|
"random": randomprovider.Provider(),
|
||||||
|
},
|
||||||
CheckDestroy: testAccCheckAWSPolicyAttachmentDestroy,
|
CheckDestroy: testAccCheckAWSPolicyAttachmentDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
|
@ -303,9 +307,13 @@ resource "aws_iam_policy_attachment" "test-attach" {
|
||||||
}
|
}
|
||||||
|
|
||||||
const testAccAWSPolicyPaginatedAttachConfig = `
|
const testAccAWSPolicyPaginatedAttachConfig = `
|
||||||
|
resource "random_id" "user_id" {
|
||||||
|
byte_length = 10
|
||||||
|
}
|
||||||
|
|
||||||
resource "aws_iam_user" "user" {
|
resource "aws_iam_user" "user" {
|
||||||
count = 101
|
count = 101
|
||||||
name = "${format("paged-test-user-%d", count.index + 1)}"
|
name = "${format("paged-test-user-${random_id.user_id.hex}-%d", count.index + 1)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_iam_policy" "policy" {
|
resource "aws_iam_policy" "policy" {
|
||||||
|
|
Loading…
Reference in New Issue