From c9808a63add2b6cd42dbf60fd0096a9c8e405961 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 19 Dec 2024 14:59:02 -0500 Subject: [PATCH] Adds test to ensure invalid SIDs are allowed --- .../iam/policy_document_data_source_test.go | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/internal/service/iam/policy_document_data_source_test.go b/internal/service/iam/policy_document_data_source_test.go index 91297fe9a1e..6fe96960d55 100644 --- a/internal/service/iam/policy_document_data_source_test.go +++ b/internal/service/iam/policy_document_data_source_test.go @@ -236,6 +236,21 @@ func TestAccIAMPolicyDocumentDataSource_overrideList(t *testing.T) { }) } +func TestAccIAMPolicyDocumentDataSource_invalidSidValid(t *testing.T) { + ctx := acctest.Context(t) + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, names.IAMServiceID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testAccPolicyDocumentDataSourceConfig_invalidSid, + PlanOnly: true, + }, + }, + }) +} + func TestAccIAMPolicyDocumentDataSource_noStatementMerge(t *testing.T) { ctx := acctest.Context(t) resource.ParallelTest(t, resource.TestCase{ @@ -1022,6 +1037,18 @@ data "aws_iam_policy_document" "test_source_conflicting" { } ` +var testAccPolicyDocumentDataSourceConfig_invalidSid = ` +data "aws_iam_policy_document" "test" { + statement { + sid = "Invalid SID" + actions = [ + "s3:ListAllMyBuckets", + "s3:GetBucketLocation", + ] + } +} +` + var testAccPolicyDocumentSourceConflictingExpectedJSON = `{ "Version": "2012-10-17", "Statement": [