Skip to content

Fix CUR 2.0 query: remove invalid column#119

Closed
Alexanderamiri wants to merge 1 commit into
mainfrom
fix/cur-query-columns
Closed

Fix CUR 2.0 query: remove invalid column#119
Alexanderamiri wants to merge 1 commit into
mainfrom
fix/cur-query-columns

Conversation

@Alexanderamiri
Copy link
Copy Markdown
Member

Summary

Removes line_item_resource_id from the CUR 2.0 Data Exports query. This column exists in CUR 1.0 but not in CUR 2.0. In CUR 2.0, resource information is in the resource_tags column when INCLUDE_RESOURCES=TRUE.

This has been causing every CI apply to fail with ValidationException: Invalid QueryStatement since the cost-analytics module was added.

Test plan

  • CI plan shows CUR export resource updated
  • Apply succeeds without Invalid QueryStatement error

line_item_resource_id does not exist in the CUR 2.0 schema. In CUR 2.0
resource information is embedded in resource_tags when INCLUDE_RESOURCES
is TRUE. This column was causing every CI apply to fail with
"ValidationException: Invalid QueryStatement".
@Alexanderamiri Alexanderamiri requested a review from a team as a code owner March 30, 2026 22:28
@github-actions
Copy link
Copy Markdown

Terraform Plan

🚧 Changes detected — Plan: 0 to add, 1 to change, 0 to destroy.

Plan output

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.cost_analytics.aws_bcmdataexports_export.cur will be updated in-place
  ~ resource "aws_bcmdataexports_export" "cur" {
        id       = "arn:aws:bcm-data-exports:us-east-1:553637109631:export/javabin-cur-b7cd78f2-2113-4718-bb2f-bc277945afd5"
        # (1 unchanged attribute hidden)

      ~ export {
            name       = "javabin-cur"
            # (1 unchanged attribute hidden)

          ~ data_query {
              ~ query_statement      = "SELECT identity_line_item_id, identity_time_interval, bill_bill_type, bill_payer_account_id, bill_billing_period_start_date, bill_billing_period_end_date, line_item_usage_account_id, line_item_line_item_type, line_item_usage_start_date, line_item_usage_end_date, line_item_product_code, line_item_usage_type, line_item_operation, line_item_availability_zone, line_item_resource_id, line_item_usage_amount, line_item_currency_code, line_item_unblended_rate, line_item_unblended_cost, line_item_blended_rate, line_item_blended_cost, line_item_line_item_description, product_product_family, product_region_code, product_instance_type, product_servicecode, pricing_unit, pricing_public_on_demand_cost, pricing_public_on_demand_rate, pricing_term, resource_tags FROM COST_AND_USAGE_REPORT" -> "SELECT identity_line_item_id, identity_time_interval, bill_bill_type, bill_payer_account_id, bill_billing_period_start_date, bill_billing_period_end_date, line_item_usage_account_id, line_item_line_item_type, line_item_usage_start_date, line_item_usage_end_date, line_item_product_code, line_item_usage_type, line_item_operation, line_item_availability_zone, line_item_usage_amount, line_item_currency_code, line_item_unblended_rate, line_item_unblended_cost, line_item_blended_rate, line_item_blended_cost, line_item_line_item_description, product_product_family, product_region_code, product_instance_type, product_servicecode, pricing_unit, pricing_public_on_demand_cost, pricing_public_on_demand_rate, pricing_term, resource_tags FROM COST_AND_USAGE_REPORT"
                # (1 unchanged attribute hidden)
            }

            # (2 unchanged blocks hidden)
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "tfplan"

LLM Review

Risk: 🟢 LOW

Routine update to Cost and Usage Report (CUR) export query statement with no resource creation, destruction, or security changes.

  • [routine] Single in-place update to aws_bcmdataexports_export.cur query statement - removing line_item_resource_id from SELECT clause
  • [routine] No resources being created or destroyed - only 1 resource modification
  • [routine] No security, IAM, or network changes - cost analytics query refinement only
  • 💰 [cost] Query modification may reduce data volume exported, potentially lowering storage and processing costs

@Alexanderamiri
Copy link
Copy Markdown
Member Author

Closing — the CUR export is already in state and working (HEALTHY). The error was from older CI runs. Recent runs on main all pass successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant