From 6d6f99df3cccb4d359d7b467cff85eaaf82563db Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Mon, 1 Dec 2025 16:20:01 -0800 Subject: [PATCH 1/2] Skips Billing Views with type other than `CUSTOM` --- internal/service/billing/sweep.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/service/billing/sweep.go b/internal/service/billing/sweep.go index fa50a556c0a8..c917157fa4ad 100644 --- a/internal/service/billing/sweep.go +++ b/internal/service/billing/sweep.go @@ -5,10 +5,13 @@ package billing import ( "context" + "fmt" "github.com/YakDriver/smarterr" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/billing" + awstypes "github.com/aws/aws-sdk-go-v2/service/billing/types" + "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/sweep" "github.com/hashicorp/terraform-provider-aws/internal/sweep/awsv2" @@ -21,10 +24,11 @@ func RegisterSweepers() { } func sweepViews(ctx context.Context, client *conns.AWSClient) ([]sweep.Sweepable, error) { - input := billing.ListBillingViewsInput{} conn := client.BillingClient(ctx) + var sweepResources []sweep.Sweepable + input := billing.ListBillingViewsInput{} pages := billing.NewListBillingViewsPaginator(conn, &input) for pages.HasMorePages() { page, err := pages.NextPage(ctx) @@ -33,6 +37,12 @@ func sweepViews(ctx context.Context, client *conns.AWSClient) ([]sweep.Sweepable } for _, v := range page.BillingViews { + if v.BillingViewType != awstypes.BillingViewTypeCustom { + tflog.Info(ctx, "Skipping resource", map[string]any{ + "skip_reason": fmt.Sprintf("View Type is %q", v.BillingViewType), + }) + continue + } sweepResources = append(sweepResources, framework.NewSweepResource(newResourceView, client, framework.NewAttribute(names.AttrARN, aws.ToString(v.Arn))), ) From 3f9bbc4aebc75acdb6f968e45306676e287745ac Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Mon, 1 Dec 2025 16:26:30 -0800 Subject: [PATCH 2/2] Logs `name` --- internal/service/billing/sweep.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/service/billing/sweep.go b/internal/service/billing/sweep.go index c917157fa4ad..c6827029fe18 100644 --- a/internal/service/billing/sweep.go +++ b/internal/service/billing/sweep.go @@ -39,7 +39,8 @@ func sweepViews(ctx context.Context, client *conns.AWSClient) ([]sweep.Sweepable for _, v := range page.BillingViews { if v.BillingViewType != awstypes.BillingViewTypeCustom { tflog.Info(ctx, "Skipping resource", map[string]any{ - "skip_reason": fmt.Sprintf("View Type is %q", v.BillingViewType), + names.AttrName: aws.ToString(v.Name), + "skip_reason": fmt.Sprintf("View Type is %q", v.BillingViewType), }) continue }