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

r/s3_bucket_server_side_encryption_configuration: retry on SSE not found errors #24266

Merged
merged 2 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
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