Skip to content

Commit

Permalink
r/aws_s3_directory_bucket: Fix sweeper.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Nov 30, 2023
1 parent 257f105 commit 27b2c8d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal/service/s3/sweep.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func sweepObjects(region string) error {
continue
}

sweepables = append(sweepables, objectSweeper{
sweepables = append(sweepables, directoryBucketObjectSweeper{
conn: conn,
bucket: aws.ToString(v.Name),
})
Expand Down Expand Up @@ -145,6 +145,19 @@ func (os objectSweeper) Delete(ctx context.Context, timeout time.Duration, optFn
return nil
}

type directoryBucketObjectSweeper struct {
conn *s3.Client
bucket string
}

func (os directoryBucketObjectSweeper) Delete(ctx context.Context, timeout time.Duration, optFns ...tfresource.OptionsFunc) error {
_, err := emptyDirectoryBucket(ctx, os.conn, os.bucket)
if err != nil {
return fmt.Errorf("deleting S3 Directory Bucket (%s) objects: %w", os.bucket, err)
}
return nil
}

func sweepBuckets(region string) error {
ctx := sweep.Context(region)
client, err := sweep.SharedRegionalSweepClient(ctx, region)
Expand Down

0 comments on commit 27b2c8d

Please sign in to comment.