Skip to content

Commit

Permalink
Merge pull request #34504 from hashicorp/td-s3-more-aws-sdk-go-v2
Browse files Browse the repository at this point in the history
Migrate `aws_s3_bucket_lifecycle_configuration` and `aws_s3_bucket_replication_configuration` to AWS SDK for Go v2
  • Loading branch information
ewbankkit authored Nov 22, 2023
2 parents 1913fce + 27d1212 commit 5e7d6fe
Show file tree
Hide file tree
Showing 17 changed files with 1,872 additions and 1,912 deletions.
3 changes: 3 additions & 0 deletions .changelog/34504.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_s3_bucket_logging: Add `target_object_key_format` configuration block to support [automatic date-based partitioning](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html#server-access-logging-overview)
```
4 changes: 4 additions & 0 deletions .ci/.golangci2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ issues:
- staticcheck
path: "internal/service/s3"
text: "SA1019: \\w+.(\\w+) is deprecated: (\\w+) has been deprecated"
- linters:
- staticcheck
path: "internal/service/s3"
text: "SA1019: \\w+.(\\w+) is deprecated: This member has been deprecated"
- linters:
- staticcheck
path: internal/service/securityhub/
Expand Down
8 changes: 6 additions & 2 deletions internal/service/s3/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ import (

const (
resNameBucket = "Bucket"

// General timeout for S3 bucket changes to propagate.
// See https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html#ConsistencyModel.
s3BucketPropagationTimeout = 2 * time.Minute // nosemgrep:ci.s3-in-const-name, ci.s3-in-var-name
)

// @SDKResource("aws_s3_bucket", name="Bucket")
Expand Down Expand Up @@ -1047,7 +1051,7 @@ func resourceBucketRead(ctx context.Context, d *schema.ResourceData, meta interf
return diags
}

if err != nil && !tfawserr.ErrCodeEquals(err, ErrCodeNoSuchLifecycleConfiguration, errCodeNotImplemented, errCodeXNotImplemented) {
if err != nil && !tfawserr.ErrCodeEquals(err, errCodeNoSuchLifecycleConfiguration, errCodeNotImplemented, errCodeXNotImplemented) {
return sdkdiag.AppendErrorf(diags, "getting S3 Bucket (%s) Lifecycle Configuration: %s", d.Id(), err)
}

Expand Down Expand Up @@ -1076,7 +1080,7 @@ func resourceBucketRead(ctx context.Context, d *schema.ResourceData, meta interf
return diags
}

if err != nil && !tfawserr.ErrCodeEquals(err, ErrCodeReplicationConfigurationNotFound, errCodeNotImplemented, errCodeXNotImplemented) {
if err != nil && !tfawserr.ErrCodeEquals(err, errCodeReplicationConfigurationNotFound, errCodeNotImplemented, errCodeXNotImplemented) {
return sdkdiag.AppendErrorf(diags, "getting S3 Bucket replication: %s", err)
}

Expand Down
Loading

0 comments on commit 5e7d6fe

Please sign in to comment.