Skip to content

Commit

Permalink
Merge pull request #34114 from bryantbiggs/refactor/eks-aws-sdk-go-v2
Browse files Browse the repository at this point in the history
feat: Udpate EKS to use aws-sdk-go-v2
  • Loading branch information
ewbankkit authored Nov 8, 2023
2 parents a6de4fa + 1c2ec47 commit a0e3a30
Show file tree
Hide file tree
Showing 49 changed files with 1,540 additions and 1,708 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/directoryservice v1.21.0
github.com/aws/aws-sdk-go-v2/service/docdbelastic v1.5.0
github.com/aws/aws-sdk-go-v2/service/ec2 v1.130.0
github.com/aws/aws-sdk-go-v2/service/eks v1.32.0
github.com/aws/aws-sdk-go-v2/service/emrserverless v1.13.0
github.com/aws/aws-sdk-go-v2/service/finspace v1.16.0
github.com/aws/aws-sdk-go-v2/service/fis v1.19.0
Expand Down Expand Up @@ -71,6 +72,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssm v1.42.0
github.com/aws/aws-sdk-go-v2/service/ssmcontacts v1.19.0
github.com/aws/aws-sdk-go-v2/service/ssmincidents v1.25.0
github.com/aws/aws-sdk-go-v2/service/sts v1.25.0
github.com/aws/aws-sdk-go-v2/service/swf v1.19.0
github.com/aws/aws-sdk-go-v2/service/timestreamwrite v1.22.0
github.com/aws/aws-sdk-go-v2/service/transcribe v1.31.0
Expand Down Expand Up @@ -140,7 +142,6 @@ require (
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.17.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.25.0 // indirect
github.com/aws/smithy-go v1.16.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/boombuler/barcode v1.0.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ github.com/aws/aws-sdk-go-v2/service/dynamodb v1.23.0 h1:xmSAn14nM6IdHyuWO/bsrAa
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.23.0/go.mod h1:1HkLh8vaL4obF95fne7ZOu7sxomS/+vkBt3/+gqqwE4=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.130.0 h1:a7CPCX/m+owAiAqcK8W9/SoB7EA4QUE4BddYdFyEGco=
github.com/aws/aws-sdk-go-v2/service/ec2 v1.130.0/go.mod h1:EJlGVMO5zynmSDdvwJfFa2RzAZoHI4gVJER0h82/dYk=
github.com/aws/aws-sdk-go-v2/service/eks v1.32.0 h1:w8O52S+rH0026BqntZs55OWbV8Huq8VhXL9bSixCRYc=
github.com/aws/aws-sdk-go-v2/service/eks v1.32.0/go.mod h1:l13fsSUzq27egNlyKBw4l0+mOSwa5Kt6r3JmJblYt14=
github.com/aws/aws-sdk-go-v2/service/emrserverless v1.13.0 h1:y56k/4nfqSV8iQ7Us/TnoXhTqlhWz//V5uxQdfMbMKE=
github.com/aws/aws-sdk-go-v2/service/emrserverless v1.13.0/go.mod h1:IGFmVFAav4kjHb/AjYiu677R0hvU9Knhy3MwkEcvdjw=
github.com/aws/aws-sdk-go-v2/service/finspace v1.16.0 h1:vUaANfye60JdQ6naelwbw30GO5qJzv+Ks1+R3JjcW7o=
Expand Down
4 changes: 2 additions & 2 deletions internal/acctest/acctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ func PreCheckOrganizationManagementAccount(ctx context.Context, t *testing.T) {
t.Fatalf("describing AWS Organization: %s", err)
}

callerIdentity, err := tfsts.FindCallerIdentity(ctx, Provider.Meta().(*conns.AWSClient).STSConn(ctx))
callerIdentity, err := tfsts.FindCallerIdentity(ctx, Provider.Meta().(*conns.AWSClient).STSClient(ctx))

if err != nil {
t.Fatalf("getting current identity: %s", err)
Expand All @@ -1007,7 +1007,7 @@ func PreCheckOrganizationMemberAccount(ctx context.Context, t *testing.T) {
t.Fatalf("describing AWS Organization: %s", err)
}

callerIdentity, err := tfsts.FindCallerIdentity(ctx, Provider.Meta().(*conns.AWSClient).STSConn(ctx))
callerIdentity, err := tfsts.FindCallerIdentity(ctx, Provider.Meta().(*conns.AWSClient).STSClient(ctx))

if err != nil {
t.Fatalf("getting current identity: %s", err)
Expand Down
11 changes: 8 additions & 3 deletions internal/conns/awsclient_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions internal/enum/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ type Valueser[T ~string] interface {
Values() []T
}

func Values[T Valueser[T]]() []string {
l := T("").Values()
func EnumValues[T Valueser[T]]() []T {
return T("").Values()
}

return Slice(l...)
func Values[T Valueser[T]]() []string {
return Slice(EnumValues[T]()...)
}

func Slice[T Valueser[T]](l ...T) []string {
Expand Down
28 changes: 28 additions & 0 deletions internal/enum/values_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package enum

import (
"testing"

"github.com/aws/aws-sdk-go-v2/service/accessanalyzer/types"
"github.com/google/go-cmp/cmp"
)

func TestValues(t *testing.T) {
t.Parallel()

want := []string{
"READ",
"WRITE",
"READ_ACP",
"WRITE_ACP",
"FULL_CONTROL",
}
got := Values[types.AclPermission]()

if diff := cmp.Diff(got, want); diff != "" {
t.Errorf("unexpected diff (+wanted, -got): %s", diff)
}
}
19 changes: 1 addition & 18 deletions internal/service/dms/event_subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/aws/aws-sdk-go/aws"
dms "github.com/aws/aws-sdk-go/service/databasemigrationservice"
"github.com/aws/aws-sdk-go/service/eks"
"github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr"
sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
Expand Down Expand Up @@ -168,7 +167,7 @@ func TestAccDMSEventSubscription_tags(t *testing.T) {
resourceName := "aws_dms_event_subscription.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheckEKS(ctx, t) },
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, dms.EndpointsID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckEventSubscriptionDestroy(ctx),
Expand Down Expand Up @@ -387,19 +386,3 @@ resource "aws_dms_event_subscription" "test" {
}
`, rName, tagKey1, tagValue1, tagKey2, tagValue2))
}

func testAccPreCheckEKS(ctx context.Context, t *testing.T) {
conn := acctest.Provider.Meta().(*conns.AWSClient).EKSConn(ctx)

input := &eks.ListClustersInput{}

_, err := conn.ListClustersWithContext(ctx, input)

if acctest.PreCheckSkipError(err) {
t.Skipf("skipping acceptance testing: %s", err)
}

if err != nil {
t.Fatalf("unexpected PreCheck error: %s", err)
}
}
Loading

0 comments on commit a0e3a30

Please sign in to comment.