hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.65k forks source link

Support for `file_format` in azurerm_subscription_cost_management_export #27097

Open nklsdhbw opened 2 months ago

nklsdhbw commented 2 months ago

Is there an existing issue for this?

Community Note

Description

Data is currently exported as CSV by default. Recently, the Parquet export option has also been added to the Azure portal. A parameter to select the file format would therefore be ideal to reduce storage requirements and associated costs.

New or Affected Resource(s)/Data Source(s)

azurerm_subscription_cost_management_export

Potential Terraform Configuration

resource "azurerm_billing_account_cost_management_export" "Daily_MonthToDate" {
  name                         = "MonthToDate"
  billing_account_id           = var.billing_account_id
  recurrence_type              = "Daily"
  recurrence_period_start_date = local.start_time
  recurrence_period_end_date   = "2030-09-20T00:00:00Z"

  export_data_storage_location {
    container_id     = azurerm_storage_container.cost_data.resource_manager_id
    root_folder_path = "daily"
  }

  export_data_options {
    type       = "ActualCost"
    time_frame = "MonthToDate"
    file_format = "Parquet"
  }

  identity = {
    type = "SystemAssigned"
  }

}

References

No response

ned1313 commented 2 months ago

Per the API, the format is a top-level argument and not specific to the definition.

Does it make more sense to include it as a top-level argument in the resource?

resource "azurerm_billing_account_cost_management_export" "Daily_MonthToDate" {
  name                         = "MonthToDate"
  billing_account_id           = var.billing_account_id
  recurrence_type              = "Daily"
  recurrence_period_start_date = local.start_time
  recurrence_period_end_date   = "2030-09-20T00:00:00Z"
  file_format = "Parquet"

  export_data_storage_location {
    container_id     = azurerm_storage_container.cost_data.resource_manager_id
    root_folder_path = "daily"
  }

  export_data_options {
    type       = "ActualCost"
    time_frame = "MonthToDate"
  }

  identity = {
    type = "SystemAssigned"
  }

}

Also, quick note that the current SDK only supports CSV as a valid format type.