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.61k stars 4.65k forks source link

Support for overwriting data in azurerm_subscription_cost_management_export #27098

Open nklsdhbw opened 3 months ago

nklsdhbw commented 3 months ago

Is there an existing issue for this?

Community Note

Description

When using the MonthToDate time_frame, a new file is created every day instead of overwriting the old file. To reduce storage and therefore cost, an option to overwrite the old file, as you can select in the Azure portal, would be perfect.

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"
    overwrite_data = true
  }

  identity = {
    type = "SystemAssigned"
  }

}

References

No response

neil-yechenwei commented 3 months ago

Thanks for raising this issue. This feature currently is still in preview. As preview version may cause breaking change between preview version and stable version, so we will take another look once it's released to stable version.