mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-20 11:48:24 -06:00
Removed random provider frm iam policy attachment test
This commit is contained in:
parent
fae435c5d8
commit
e2d7d5fc68
@ -6,7 +6,6 @@ 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"
|
||||||
@ -44,17 +43,15 @@ func TestAccAWSPolicyAttachment_basic(t *testing.T) {
|
|||||||
|
|
||||||
func TestAccAWSPolicyAttachment_paginatedEntities(t *testing.T) {
|
func TestAccAWSPolicyAttachment_paginatedEntities(t *testing.T) {
|
||||||
var out iam.ListEntitiesForPolicyOutput
|
var out iam.ListEntitiesForPolicyOutput
|
||||||
|
rInt := acctest.RandInt()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: map[string]terraform.ResourceProvider{
|
Providers: testAccProviders,
|
||||||
"aws": testAccProvider,
|
|
||||||
"random": randomprovider.Provider(),
|
|
||||||
},
|
|
||||||
CheckDestroy: testAccCheckAWSPolicyAttachmentDestroy,
|
CheckDestroy: testAccCheckAWSPolicyAttachmentDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: testAccAWSPolicyPaginatedAttachConfig,
|
Config: testAccAWSPolicyPaginatedAttachConfig(rInt),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckAWSPolicyAttachmentExists("aws_iam_policy_attachment.test-paginated-attach", 101, &out),
|
testAccCheckAWSPolicyAttachmentExists("aws_iam_policy_attachment.test-paginated-attach", 101, &out),
|
||||||
),
|
),
|
||||||
@ -306,38 +303,33 @@ resource "aws_iam_policy_attachment" "test-attach" {
|
|||||||
}`, u1, u2, u3)
|
}`, u1, u2, u3)
|
||||||
}
|
}
|
||||||
|
|
||||||
const testAccAWSPolicyPaginatedAttachConfig = `
|
func testAccAWSPolicyPaginatedAttachConfig(rInt int) string {
|
||||||
resource "random_id" "user_id" {
|
return fmt.Sprintf(`
|
||||||
byte_length = 10
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "aws_iam_user" "user" {
|
resource "aws_iam_user" "user" {
|
||||||
count = 101
|
count = 101
|
||||||
name = "${format("paged-test-user-${random_id.user_id.hex}-%d", count.index + 1)}"
|
name = "${format("paged-test-user-%d-%%d", count.index + 1)}"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_iam_policy" "policy" {
|
resource "aws_iam_policy" "policy" {
|
||||||
name = "test-policy"
|
name = "test-policy"
|
||||||
description = "A test policy"
|
description = "A test policy"
|
||||||
policy = <<EOF
|
policy = <<EOF
|
||||||
{
|
{
|
||||||
"Version": "2012-10-17",
|
"Version": "2012-10-17",
|
||||||
"Statement": [
|
"Statement": [
|
||||||
{
|
{
|
||||||
"Action": [
|
"Action": [
|
||||||
"iam:ChangePassword"
|
"iam:ChangePassword"
|
||||||
],
|
],
|
||||||
"Resource": "*",
|
"Resource": "*",
|
||||||
"Effect": "Allow"
|
"Effect": "Allow"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_iam_policy_attachment" "test-paginated-attach" {
|
resource "aws_iam_policy_attachment" "test-paginated-attach" {
|
||||||
name = "test-attachment"
|
name = "test-attachment"
|
||||||
users = ["${aws_iam_user.user.*.name}"]
|
users = ["${aws_iam_user.user.*.name}"]
|
||||||
policy_arn = "${aws_iam_policy.policy.arn}"
|
policy_arn = "${aws_iam_policy.policy.arn}"
|
||||||
|
}`, rInt)
|
||||||
}
|
}
|
||||||
`
|
|
||||||
|
Loading…
Reference in New Issue
Block a user