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
…autoscaling.

```console
% make testacc TESTARGS='-run=TestAccAutoScalingGroup_basic\|TestAccAutoScalingGroup_withTrafficSourcesELBs\|TestAccAutoScalingGroup_loadBalancers\|TestAccAutoScalingGroup_targetGroups' PKG=autoscaling
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.6 test ./internal/service/autoscaling/... -v -count 1 -parallel 20  -run=TestAccAutoScalingGroup_basic\|TestAccAutoScalingGroup_withTrafficSourcesELBs\|TestAccAutoScalingGroup_loadBalancers\|TestAccAutoScalingGroup_targetGroups -timeout 360m

--- PASS: TestAccAutoScalingGroup_basic (28.41s)
--- PASS: TestAccAutoScalingGroup_targetGroups (108.44s)
--- PASS: TestAccAutoScalingGroup_loadBalancers (287.88s)
--- PASS: TestAccAutoScalingGroup_withTrafficSourcesELBs (374.16s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/autoscaling        380.382s
```
  • Loading branch information
jar-b committed Sep 10, 2024
1 parent b142d28 commit a351eb1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/service/autoscaling/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import ( // nosemgrep:ci.semgrep.aws.multiple-service-imports
"errors"
"fmt"
"log"
"slices"
"strconv"
"strings"
"time"
Expand All @@ -35,6 +34,7 @@ import ( // nosemgrep:ci.semgrep.aws.multiple-service-imports
"github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag"
"github.com/hashicorp/terraform-provider-aws/internal/flex"
"github.com/hashicorp/terraform-provider-aws/internal/sdkv2/types/nullable"
tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices"
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
"github.com/hashicorp/terraform-provider-aws/internal/verify"
"github.com/hashicorp/terraform-provider-aws/names"
Expand Down Expand Up @@ -1504,7 +1504,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter

// API only supports adding or removing 10 at a time.
batchSize := 10
for chunk := range slices.Chunk(expandTrafficSourceIdentifiers(os.Difference(ns).List()), batchSize) {
for _, chunk := range tfslices.Chunks(expandTrafficSourceIdentifiers(os.Difference(ns).List()), batchSize) {
input := &autoscaling.DetachTrafficSourcesInput{
AutoScalingGroupName: aws.String(d.Id()),
TrafficSources: chunk,
Expand All @@ -1521,7 +1521,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter
}
}

for chunk := range slices.Chunk(expandTrafficSourceIdentifiers(ns.Difference(os).List()), batchSize) {
for _, chunk := range tfslices.Chunks(expandTrafficSourceIdentifiers(ns.Difference(os).List()), batchSize) {
input := &autoscaling.AttachTrafficSourcesInput{
AutoScalingGroupName: aws.String(d.Id()),
TrafficSources: chunk,
Expand All @@ -1545,7 +1545,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter

// API only supports adding or removing 10 at a time.
batchSize := 10
for chunk := range slices.Chunk(flex.ExpandStringValueSet(os.Difference(ns)), batchSize) {
for _, chunk := range tfslices.Chunks(flex.ExpandStringValueSet(os.Difference(ns)), batchSize) {
input := &autoscaling.DetachLoadBalancersInput{
AutoScalingGroupName: aws.String(d.Id()),
LoadBalancerNames: chunk,
Expand All @@ -1562,7 +1562,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter
}
}

for chunk := range slices.Chunk(flex.ExpandStringValueSet(ns.Difference(os)), batchSize) {
for _, chunk := range tfslices.Chunks(flex.ExpandStringValueSet(ns.Difference(os)), batchSize) {
input := &autoscaling.AttachLoadBalancersInput{
AutoScalingGroupName: aws.String(d.Id()),
LoadBalancerNames: chunk,
Expand All @@ -1586,7 +1586,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter

// API only supports adding or removing 10 at a time.
batchSize := 10
for chunk := range slices.Chunk(flex.ExpandStringValueSet(os.Difference(ns)), batchSize) {
for _, chunk := range tfslices.Chunks(flex.ExpandStringValueSet(os.Difference(ns)), batchSize) {
input := &autoscaling.DetachLoadBalancerTargetGroupsInput{
AutoScalingGroupName: aws.String(d.Id()),
TargetGroupARNs: chunk,
Expand All @@ -1603,7 +1603,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter
}
}

for chunk := range slices.Chunk(flex.ExpandStringValueSet(ns.Difference(os)), batchSize) {
for _, chunk := range tfslices.Chunks(flex.ExpandStringValueSet(ns.Difference(os)), batchSize) {
input := &autoscaling.AttachLoadBalancerTargetGroupsInput{
AutoScalingGroupName: aws.String(d.Id()),
TargetGroupARNs: chunk,
Expand Down Expand Up @@ -1864,7 +1864,7 @@ func drainGroup(ctx context.Context, conn *autoscaling.Client, name string, inst
}
}
const batchSize = 50 // API limit.
for chunk := range slices.Chunk(instanceIDs, batchSize) {
for _, chunk := range tfslices.Chunks(instanceIDs, batchSize) {
input := &autoscaling.SetInstanceProtectionInput{
AutoScalingGroupName: aws.String(name),
InstanceIds: chunk,
Expand Down

0 comments on commit a351eb1

Please sign in to comment.