diff --git a/internal/service/billing/sweep.go b/internal/service/billing/sweep.go index fa50a556c0a8..c6827029fe18 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,13 @@ 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{ + names.AttrName: aws.ToString(v.Name), + "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))), )