Skip to content

Commit e97e369

Browse files
Fix CUR 2.0 query with valid column names (#114)
## Summary `SELECT *` is not supported by BCM Data Exports API — it returns `ValidationException: Invalid QueryStatement`. Column names retrieved directly from the API: ``` aws bcm-data-exports get-table --table-name COST_AND_USAGE_REPORT \ --table-properties '{"TIME_GRANULARITY":"DAILY","INCLUDE_RESOURCES":"TRUE",...}' ``` Key columns included: `line_item_resource_id`, `line_item_product_code`, `line_item_unblended_cost`, `resource_tags` (single map column in CUR 2.0, not separate `resource_tags_user_*` columns like legacy CUR). ## Test plan - [ ] CI plan + apply succeeds - [ ] CUR export created in us-east-1 without validation error
1 parent 4d86bef commit e97e369

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • terraform/platform/cost-analytics

terraform/platform/cost-analytics/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ resource "aws_bcmdataexports_export" "cur" {
154154
name = local.cur_report_name
155155

156156
data_query {
157-
query_statement = "SELECT * FROM COST_AND_USAGE_REPORT"
157+
# Column names from: aws bcm-data-exports get-table --table-name COST_AND_USAGE_REPORT
158+
# with INCLUDE_RESOURCES=TRUE. resource_tags is a single map column in CUR 2.0.
159+
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"
158160

159161
table_configurations = {
160162
COST_AND_USAGE_REPORT = {

0 commit comments

Comments
 (0)