Skip to content
Open
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/1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_s3_bucket_lifecycle_configuration: Normalize empty prefix values when reading lifecycle configurations from S3-compatible services
```
11 changes: 11 additions & 0 deletions internal/service/s3/bucket_lifecycle_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,17 @@ func findBucketLifecycleConfiguration(ctx context.Context, conn *s3.Client, buck
}
}

// For legacy-mode reasons, we normalize empty `prefix` is nil when making requests to S3 and storing internal state.
// Some S3 compatible services might return empty string as an equivalent representation. To maintain a consistent state we should normalize that back to nil.
for i := range output.Rules {
rule := &output.Rules[i]
//nolint:staticcheck // Yes the attribute Prefix is deprecated, but the following functionality is required for compatibility with non AWS systems
if aws.ToString((*rule).Prefix) == "" {
//nolint:staticcheck // Yes the attribute Prefix is deprecated, but the following functionality is required for compatibility with non AWS systems
(*rule).Prefix = nil
}
}

if err != nil {
return nil, err
}
Expand Down
Loading