Skip to content

Commit

Permalink
Merge pull request #33 from hashicorp/main
Browse files Browse the repository at this point in the history
Fork Sync: Update from parent repository
  • Loading branch information
mbialon authored Sep 29, 2023
2 parents 6337c2c + 2828878 commit 5787c66
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## 5.19.0 (Unreleased)
## 5.20.0 (Unreleased)
## 5.19.0 (September 29, 2023)

BREAKING CHANGES:

Expand Down
64 changes: 60 additions & 4 deletions internal/service/s3control/multi_region_access_point_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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$`)),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -369,3 +390,38 @@ 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
}
}
# Ensure that we can GET through the bucket.
data "aws_s3_object" "test" {
bucket = aws_s3_bucket.test.bucket
key = aws_s3_object.test.key
}
`, bucketName, multiRegionAccessPointName)
}
3 changes: 1 addition & 2 deletions internal/service/ssoadmin/sweep.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ssoadmin"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-provider-aws/internal/sweep"
"github.com/hashicorp/terraform-provider-aws/internal/sweep/sdk"
Expand Down Expand Up @@ -165,7 +164,7 @@ func sweepPermissionSets(region string) error {
return err
}

instanceArn := dsData.Get("arns").(*schema.Set).List()[0].(string)
instanceArn := dsData.Get("arns").([]interface{})[0].(string)

input := &ssoadmin.ListPermissionSetsInput{
InstanceArn: aws.String(instanceArn),
Expand Down

0 comments on commit 5787c66

Please sign in to comment.