Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate dynamodb resources to AWS SDK for Go v2 #37288

Merged
merged 34 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7f148fa
dynamodb: Only use AWS SDK for Go v2.
ewbankkit May 5, 2024
103b929
Run 'make gen'.
ewbankkit May 5, 2024
5abc652
dynamodb: Migrate ARN function to AWS SDK for Go v2.
ewbankkit May 5, 2024
80c8d6d
r/aws_dynamodb_tag: Migrate to AWS SDK for Go v2.
ewbankkit May 5, 2024
2a5c845
r/aws_dynamodb_contributor_insights: Migrate to AWS SDK for Go v2.
ewbankkit May 5, 2024
6d5a506
listBackups: Migrate to AWS SDK for Go v2.
ewbankkit May 5, 2024
6ad2d29
r/aws_dynamodb_kinesis_streaming_destination: Migrate to AWS SDK for …
ewbankkit May 6, 2024
a1f50b2
r/aws_dynamodb_global_table: Migrate to AWS SDK for Go v2.
ewbankkit May 6, 2024
b167747
r/aws_dynamodb_table_export: Migrate to AWS SDK for Go v2.
ewbankkit May 6, 2024
7b90149
Correct CHANGELOG entry file name.
ewbankkit May 7, 2024
9dc621c
r/aws_dynamodb_table: Migrate to AWS SDK for Go v2.
ewbankkit May 7, 2024
f09cd24
d/aws_dynamodb_table: Migrate to AWS SDK for Go v2.
ewbankkit May 7, 2024
9a7145d
r/aws_dynamodb_table_replica: Migrate to AWS SDK for Go v2.
ewbankkit May 7, 2024
c4d6800
r/aws_dynamodb_table_item: Migrate to AWS SDK for Go v2.
ewbankkit May 7, 2024
d89f04f
d/aws_dynamodb_table_item: Migrate to AWS SDK for Go v2.
ewbankkit May 7, 2024
cae442b
dynamodb: Migrate sweepers to AWS SDK for Go v2.
ewbankkit May 7, 2024
f602eb9
Migrate 'flex_test.go' to AWS SDK for Go v2.
ewbankkit May 7, 2024
d214d67
dynamodb: Fix various warning.
ewbankkit May 7, 2024
c3722db
Merge branch 'main' into td-migrate-dynamodb-to-aws-sdk-v2
ewbankkit May 7, 2024
1e83b58
Fix golangci-lint 'unparam'.
ewbankkit May 7, 2024
a863402
Fix golangci-lint 'unconvert'.
ewbankkit May 7, 2024
080c170
dynamodb: Add custom AWS SDK for Go v2 client factory.
ewbankkit May 7, 2024
b4f4ca4
Fixup 'TestUpdateDiffGSI'.
ewbankkit May 7, 2024
4e66777
Add 'tfslices.ApplyToAllWithError'.
ewbankkit May 8, 2024
fd53cbb
Work on 'expandTableItemAttributes'.
ewbankkit May 8, 2024
3135127
dynamodb: Correct NotFound error.
ewbankkit May 8, 2024
023a5ac
Use correct Region for 'waitPITRUpdated'.
ewbankkit May 8, 2024
9abe510
r/aws_sagemaker_device_fleet: Fix sweeper.
ewbankkit May 8, 2024
01795a0
Add 'tfmaps.ApplyToAllValuesWithError'.
ewbankkit May 8, 2024
d646c71
Add 'attributeFromRaw'.
ewbankkit May 8, 2024
54e6031
Simplify 'expandTableItemAttributes' and 'flattenTableItemAttributes'.
ewbankkit May 9, 2024
7dca4cf
Fix 'TestAccDynamoDBTable_attributeUpdateValidation'.
ewbankkit May 9, 2024
5d01f64
Fix 'TestAccDynamoDBTableItem_mapOutOfBandUpdate'.
ewbankkit May 9, 2024
9230fcf
Fix providerlint 'R009: avoid panic() usage'.
ewbankkit May 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/37288.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_dynamodb_table_export: Add plan-time validation of `table_arn`
```
11 changes: 0 additions & 11 deletions internal/conns/awsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
aws_sdkv1 "github.com/aws/aws-sdk-go/aws"
session_sdkv1 "github.com/aws/aws-sdk-go/aws/session"
directoryservice_sdkv1 "github.com/aws/aws-sdk-go/service/directoryservice"
dynamodb_sdkv1 "github.com/aws/aws-sdk-go/service/dynamodb"
efs_sdkv1 "github.com/aws/aws-sdk-go/service/efs"
opsworks_sdkv1 "github.com/aws/aws-sdk-go/service/opsworks"
rds_sdkv1 "github.com/aws/aws-sdk-go/service/rds"
Expand Down Expand Up @@ -64,16 +63,6 @@ func (c *AWSClient) AwsConfig(context.Context) aws_sdkv2.Config { // nosemgrep:c
return c.awsConfig.Copy()
}

// DynamoDBConnForRegion returns an AWS SDK For Go v1 DynamoDB API client for the specified AWS Region.
// If the specified region is not the default a new "simple" client is created.
// This new client does not use any configured endpoint override.
func (c *AWSClient) DynamoDBConnForRegion(ctx context.Context, region string) *dynamodb_sdkv1.DynamoDB {
if region == c.Region {
return c.DynamoDBConn(ctx)
}
return dynamodb_sdkv1.New(c.session, aws_sdkv1.NewConfig().WithRegion(region))
}

// DSConnForRegion returns an AWS SDK For Go v1 DS API client for the specified AWS Region.
// If the specified region is not the default a new "simple" client is created.
// This new client does not use any configured endpoint override.
Expand Down
5 changes: 0 additions & 5 deletions internal/conns/awsclient_gen.go

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

14 changes: 14 additions & 0 deletions internal/maps/maps.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ func ApplyToAllValues[M ~map[K]V1, K comparable, V1, V2 any](m M, f func(V1) V2)
return n
}

func ApplyToAllValuesWithError[M ~map[K]V1, K comparable, V1, V2 any](m M, f func(V1) (V2, error)) (map[K]V2, error) {
n := make(map[K]V2, len(m))

for k, v1 := range m {
v2, err := f(v1)
if err != nil {
return nil, err
}
n[k] = v2
}

return n, nil
}

// Keys returns the keys of the map `m`.
// The keys will be in an indeterminate order.
func Keys[M ~map[K]V, K comparable, V any](m M) []K {
Expand Down
8 changes: 4 additions & 4 deletions internal/service/dynamodb/arn.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package dynamodb
import (
"strings"

"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go-v2/aws/arn"
)

func ARNForNewRegion(rn string, newRegion string) (string, error) {
func arnForNewRegion(rn string, newRegion string) (string, error) {
parsedARN, err := arn.Parse(rn)
if err != nil {
return "", err
Expand All @@ -20,7 +20,7 @@ func ARNForNewRegion(rn string, newRegion string) (string, error) {
return parsedARN.String(), nil
}

func RegionFromARN(rn string) (string, error) {
func regionFromARN(rn string) (string, error) {
parsedARN, err := arn.Parse(rn)
if err != nil {
return "", err
Expand All @@ -29,7 +29,7 @@ func RegionFromARN(rn string) (string, error) {
return parsedARN.Region, nil
}

func TableNameFromARN(rn string) (string, error) {
func tableNameFromARN(rn string) (string, error) {
parsedARN, err := arn.Parse(rn)
if err != nil {
return "", err
Expand Down
28 changes: 0 additions & 28 deletions internal/service/dynamodb/backup.go

This file was deleted.

Loading
Loading