Skip to content

Commit

Permalink
Merge pull request #28530 from myst3k/add-NoSuchTagSetError-support
Browse files Browse the repository at this point in the history
adding support for NoSuchTagSetError
  • Loading branch information
gdavison authored Feb 11, 2023
2 parents 3c8bd5a + 96a7810 commit e3ade2d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changelog/28530.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
resource/aws_s3_bucket: Accept 'NoSuchTagSetError' responses from S3-compatible services
```

```release-note:enhancement
resource/aws_s3_object: Accept 'NoSuchTagSetError' responses from S3-compatible services
```
7 changes: 4 additions & 3 deletions internal/service/s3/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import (
)

const (
ErrCodeNoSuchTagSet = "NoSuchTagSet"
ErrCodeNoSuchTagSet = "NoSuchTagSet"
ErrCodeNoSuchTagSetError = "NoSuchTagSetError"
)

// Custom S3 tag service update functions using the same format as generated code.
Expand All @@ -34,7 +35,7 @@ func BucketListTags(ctx context.Context, conn *s3.S3, identifier string) (tftags
// S3 API Reference (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketTagging.html)
// lists the special error as NoSuchTagSetError, however the existing logic used NoSuchTagSet
// and the AWS Go SDK has neither as a constant.
if tfawserr.ErrCodeEquals(err, ErrCodeNoSuchTagSet) {
if tfawserr.ErrCodeEquals(err, ErrCodeNoSuchTagSet, ErrCodeNoSuchTagSetError) {
return tftags.New(nil), nil
}

Expand Down Expand Up @@ -115,7 +116,7 @@ func ObjectListTags(ctx context.Context, conn *s3.S3, bucket, key string) (tftag
output, err = conn.GetObjectTaggingWithContext(ctx, input)
}

if tfawserr.ErrCodeEquals(err, ErrCodeNoSuchTagSet) {
if tfawserr.ErrCodeEquals(err, ErrCodeNoSuchTagSet, ErrCodeNoSuchTagSetError) {
return tftags.New(nil), nil
}

Expand Down

0 comments on commit e3ade2d

Please sign in to comment.