Skip to content

Commit

Permalink
Merge pull request #24266 from hashicorp/b-s3-bucket-sse-eventual-con…
Browse files Browse the repository at this point in the history
…sistency

r/s3_bucket_server_side_encryption_configuration: retry on SSE not found errors
  • Loading branch information
anGie44 authored Apr 15, 2022
2 parents c942e1d + dc4159b commit ac4fd22
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/24266.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_s3_bucket_server_side_encryption_configuration: Retry on `ServerSideEncryptionConfigurationNotFoundError` errors due to eventual consistency
```
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,14 @@ func resourceBucketServerSideEncryptionConfigurationRead(ctx context.Context, d
input.ExpectedBucketOwner = aws.String(expectedBucketOwner)
}

resp, err := verify.RetryOnAWSCode(s3.ErrCodeNoSuchBucket, func() (interface{}, error) {
return conn.GetBucketEncryptionWithContext(ctx, input)
})
resp, err := tfresource.RetryWhenAWSErrCodeEquals(
propagationTimeout,
func() (interface{}, error) {
return conn.GetBucketEncryptionWithContext(ctx, input)
},
s3.ErrCodeNoSuchBucket,
ErrCodeServerSideEncryptionConfigurationNotFound,
)

if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, s3.ErrCodeNoSuchBucket, ErrCodeServerSideEncryptionConfigurationNotFound) {
log.Printf("[WARN] S3 Bucket Server-Side Encryption Configuration (%s) not found, removing from state", d.Id())
Expand Down

0 comments on commit ac4fd22

Please sign in to comment.