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

aws_dynamodb_table: Work around tagging limitation in dynamodb-local #6149

Merged
merged 2 commits into from
Oct 14, 2018
Merged
Changes from 1 commit
Commits
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
11 changes: 11 additions & 0 deletions aws/resource_aws_dynamodb_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/hashicorp/terraform/helper/customdiff"
"github.com/hashicorp/terraform/helper/hashcode"
Expand Down Expand Up @@ -688,6 +689,16 @@ func readDynamoDbTableTags(arn string, conn *dynamodb.DynamoDB) (map[string]stri
output, err := conn.ListTagsOfResource(&dynamodb.ListTagsOfResourceInput{
ResourceArn: aws.String(arn),
})

// Do not fail when interfacing with dynamodb-local
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest using isAWSErr if applicable (requires knowing the value of awserr.Error.Code()).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks!

if aerr.Message() == "Tagging is not currently supported in DynamoDB Local." {
err = nil
}
}
}

if err != nil {
return nil, fmt.Errorf("Error reading tags from dynamodb resource: %s", err)
}
Expand Down