diff --git a/internal/service/s3control/multi_region_access_point_test.go b/internal/service/s3control/multi_region_access_point_test.go index 1e180b9c289..2b39ab06e50 100644 --- a/internal/service/s3control/multi_region_access_point_test.go +++ b/internal/service/s3control/multi_region_access_point_test.go @@ -36,7 +36,7 @@ func TestAccS3ControlMultiRegionAccessPoint_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccMultiRegionAccessPointConfig_basic(bucketName, rName), - Check: resource.ComposeTestCheckFunc( + Check: resource.ComposeAggregateTestCheckFunc( testAccCheckMultiRegionAccessPointExists(ctx, resourceName, &v), acctest.CheckResourceAttrAccountID(resourceName, "account_id"), resource.TestMatchResourceAttr(resourceName, "alias", regexache.MustCompile(`^[a-z][0-9a-z]*[.]mrap$`)), @@ -208,6 +208,29 @@ func TestAccS3ControlMultiRegionAccessPoint_threeRegions(t *testing.T) { }) } +func TestAccS3ControlMultiRegionAccessPoint_putAndGetObject(t *testing.T) { + ctx := acctest.Context(t) + var v types.MultiRegionAccessPointReport + resourceName := "aws_s3control_multi_region_access_point.test" + bucketName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); acctest.PreCheckPartitionNot(t, names.USGovCloudPartitionID) }, + ErrorCheck: acctest.ErrorCheck(t, names.S3ControlEndpointID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckMultiRegionAccessPointDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccMultiRegionAccessPointConfig_putAndGetObject(bucketName, rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckMultiRegionAccessPointExists(ctx, resourceName, &v), + ), + }, + }, + }) +} + func testAccCheckMultiRegionAccessPointDestroy(ctx context.Context) resource.TestCheckFunc { return func(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).S3ControlClient(ctx) @@ -324,9 +347,7 @@ resource "aws_s3control_multi_region_access_point" "test" { } func testAccMultiRegionAccessPointConfig_three(bucketName1, bucketName2, bucketName3, multiRegionAccessPointName string) string { - return acctest.ConfigCompose( - acctest.ConfigMultipleRegionProvider(3), - fmt.Sprintf(` + return acctest.ConfigCompose(acctest.ConfigMultipleRegionProvider(3), fmt.Sprintf(` resource "aws_s3_bucket" "test1" { provider = aws @@ -369,3 +390,32 @@ resource "aws_s3control_multi_region_access_point" "test" { } `, bucketName1, bucketName2, bucketName3, multiRegionAccessPointName)) } + +func testAccMultiRegionAccessPointConfig_putAndGetObject(bucketName, multiRegionAccessPointName string) string { + return fmt.Sprintf(` +resource "aws_s3_bucket" "test" { + bucket = %[1]q + force_destroy = true +} + +resource "aws_s3control_multi_region_access_point" "test" { + details { + name = %[2]q + + region { + bucket = aws_s3_bucket.test.id + } + } +} + +resource "aws_s3_object" "test" { + bucket = aws_s3control_multi_region_access_point.test.arn + key = "%[1]s-key" + content = "Hello World" + + tags = { + Name = %[2]q + } +} +`, bucketName, multiRegionAccessPointName) +}