Skip to content

Commit

Permalink
Partial reversion of Replace 'tfslices.Chunks' with 'slices.Chunk' - …
Browse files Browse the repository at this point in the history
…lakeformation.

```console
% make testacc TESTARGS='-run=TestAccLakeFormation_serial/^LFTags$$' PKG=lakeformation
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/lakeformation/... -v -count 1 -parallel 20  -run=TestAccLakeFormation_serial/^LFTags$ -timeout 360m

--- PASS: TestAccLakeFormation_serial (97.10s)
    --- PASS: TestAccLakeFormation_serial/LFTags (97.10s)
        --- PASS: TestAccLakeFormation_serial/LFTags/basic (15.97s)
        --- PASS: TestAccLakeFormation_serial/LFTags/disappears (13.05s)
        --- PASS: TestAccLakeFormation_serial/LFTags/tagKeyComplex (12.14s)
        --- PASS: TestAccLakeFormation_serial/LFTags/values (24.46s)
        --- PASS: TestAccLakeFormation_serial/LFTags/valuesOverFifty (31.49s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/lakeformation      103.355s
```
  • Loading branch information
jar-b committed Sep 10, 2024
1 parent c40facf commit b142d28
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/service/lakeformation/lf_tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"fmt"
"log"
"slices"
"strings"

"github.com/YakDriver/regexache"
Expand All @@ -21,6 +20,7 @@ import (
"github.com/hashicorp/terraform-provider-aws/internal/errs"
"github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag"
"github.com/hashicorp/terraform-provider-aws/internal/flex"
tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices"
"github.com/hashicorp/terraform-provider-aws/names"
)

Expand Down Expand Up @@ -83,7 +83,7 @@ func resourceLFTagCreate(ctx context.Context, d *schema.ResourceData, meta inter
id := lfTagCreateResourceID(catalogID, tagKey)

i := 0
for chunk := range slices.Chunk(tagValues.List(), lfTagsValuesMaxBatchSize) {
for _, chunk := range tfslices.Chunks(tagValues.List(), lfTagsValuesMaxBatchSize) {
if i == 0 {
input := &lakeformation.CreateLFTagInput{
CatalogId: aws.String(catalogID),
Expand Down Expand Up @@ -169,11 +169,11 @@ func resourceLFTagUpdate(ctx context.Context, d *schema.ResourceData, meta inter

var toAddChunks, toDeleteChunks [][]interface{}
if len(toAdd.List()) > 0 {
toAddChunks = slices.Collect(slices.Chunk(toAdd.List(), lfTagsValuesMaxBatchSize))
toAddChunks = tfslices.Chunks(toAdd.List(), lfTagsValuesMaxBatchSize)
}

if len(toDelete.List()) > 0 {
toDeleteChunks = slices.Collect(slices.Chunk(toDelete.List(), lfTagsValuesMaxBatchSize))
toDeleteChunks = tfslices.Chunks(toDelete.List(), lfTagsValuesMaxBatchSize)
}

for {
Expand Down

0 comments on commit b142d28

Please sign in to comment.