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

Fixed error handling for table_aws_iam_user and table_aws_s3_bucket #2324

Merged
merged 1 commit into from
Oct 28, 2024
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
8 changes: 4 additions & 4 deletions aws/table_aws_iam_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func getAwsIamUserData(ctx context.Context, d *plugin.QueryData, h *plugin.Hydra
UserName: user.UserName,
}

userData, _ := svc.GetUser(ctx, params)
userData, err := svc.GetUser(ctx, params)
if err != nil {
plugin.Logger(ctx).Error("aws_iam_user.getAwsIamUserData", "api_error", err)
return nil, err
Expand Down Expand Up @@ -367,7 +367,7 @@ func getAwsIamUserAttachedPolicies(ctx context.Context, d *plugin.QueryData, h *
UserName: user.UserName,
}

userData, _ := svc.ListAttachedUserPolicies(ctx, params)
userData, err := svc.ListAttachedUserPolicies(ctx, params)
if err != nil {
plugin.Logger(ctx).Error("aws_iam_user.getAwsIamUserAttachedPolicies", "api_error", err)
return nil, err
Expand Down Expand Up @@ -398,7 +398,7 @@ func getAwsIamUserGroups(ctx context.Context, d *plugin.QueryData, h *plugin.Hyd
UserName: user.UserName,
}

userData, _ := svc.ListGroupsForUser(ctx, params)
userData, err := svc.ListGroupsForUser(ctx, params)
if err != nil {
plugin.Logger(ctx).Error("aws_iam_user.getAwsIamUserGroups", "api_error", err)
return nil, err
Expand All @@ -421,7 +421,7 @@ func getAwsIamUserMfaDevices(ctx context.Context, d *plugin.QueryData, h *plugin
UserName: user.UserName,
}

userData, _ := svc.ListMFADevices(ctx, params)
userData, err := svc.ListMFADevices(ctx, params)
if err != nil {
plugin.Logger(ctx).Error("aws_iam_user.getAwsIamUserMfaDevices", "api_error", err)
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions aws/table_aws_s3_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ func getBucketTagging(ctx context.Context, d *plugin.QueryData, h *plugin.Hydrat

params := &s3.GetBucketTaggingInput{Bucket: bucketName}

bucketTags, _ := svc.GetBucketTagging(ctx, params)
bucketTags, err := svc.GetBucketTagging(ctx, params)
Copy link
Contributor

@pdecat pdecat Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to reveal an issue for S3 buckets without tags:

2024-11-07 17:15:06.715 UTC [ERROR] steampipe-plugin-aws.plugin: [ERROR] 1730999705950: table 'aws_s3_bucket' failed to get column data: table 'aws_s3_bucket' column 'tags_src' requires hydrate data from getBucketTagging, which failed with error operation error S3: GetBucketTagging, https response error StatusCode: 404, RequestID: ******, HostID: ******, api error NoSuchTagSet: The TagSet does not exist.

GetBucketTagging has the following special error:
Error code: NoSuchTagSet
Description: There is no tag set associated with the bucket.

https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketTagging.html#RESTBucketGETtagging-responses

if err != nil {
plugin.Logger(ctx).Error("aws_s3_bucket.getBucketTagging", "api_error", err)
return nil, err
Expand All @@ -711,7 +711,7 @@ func getBucketWebsite(ctx context.Context, d *plugin.QueryData, h *plugin.Hydrat

params := &s3.GetBucketWebsiteInput{Bucket: bucketName}

bucketwebsites, _ := svc.GetBucketWebsite(ctx, params)
bucketwebsites, err := svc.GetBucketWebsite(ctx, params)
if err != nil {
plugin.Logger(ctx).Error("aws_s3_bucket.getBucketWebsite", "api_error", err)
return nil, err
Expand Down
Loading