Skip to content

Commit

Permalink
fix(dynamodb): properly handle ResourceInUseException for existing ta…
Browse files Browse the repository at this point in the history
…bles (#2909)

Signed-off-by: Andrei Aaron <[email protected]>
  • Loading branch information
andaaron authored Jan 24, 2025
1 parent ececc9c commit cf8b20d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/meta/dynamodb/dynamodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -2132,9 +2132,11 @@ func (dwr *DynamoDB) createTable(tableName string) error {
},
BillingMode: types.BillingModePayPerRequest,
})

if err != nil && !strings.Contains(err.Error(), "Table already exists") {
return err
if err != nil {
inUseException := new(types.ResourceInUseException)
if !errors.As(err, &inUseException) {
return err
}
}

return dwr.waitTableToBeCreated(tableName)
Expand Down Expand Up @@ -2190,7 +2192,8 @@ func (dwr *DynamoDB) createVersionTable() error {
BillingMode: types.BillingModePayPerRequest,
})
if err != nil {
if strings.Contains(err.Error(), "Table already exists") {
inUseException := new(types.ResourceInUseException)
if errors.As(err, &inUseException) {
return nil
}

Expand Down

0 comments on commit cf8b20d

Please sign in to comment.