Open JoelCanteroGCO opened 1 year ago
Thanks for raising this issue. Seems "granularity" needs to be set to "Daily".
I do encounter the same issue while trying to replicate the view below. Additionally, it seems like we cannot set the report type as ActualCost
only Usage
is valid and for the timeframe
the value Last12months
is not valid neither but it is available via API.
"value": [
{
"id": "/subscriptions/dhfksdfhksdhkhkshf/providers/Microsoft.CostManagement/views/yearlyview",
"name": "yearlyview",
"type": "Microsoft.CostManagement/Views",
"eTag": "\"dsadsadd\"",
"properties": {
"displayName": "Yearly View",
"scope": "subscriptions/kjsdfksdfhdghdoghdo",
"createdOn": "2023-08-15T12:12:02.5352058Z",
"modifiedOn": "2023-08-15T12:12:02.5352058Z",
"query": {
"type": "ActualCost",
"timeframe": "None",
"dataSet": {
"granularity": "Monthly",
"aggregation": {
"totalCost": {
"name": "Cost",
"function": "Sum"
},
"totalCostUSD": {
"name": "CostUSD",
"function": "Sum"
}
},
"grouping": [
{
"type": "Dimension",
"name": "ServiceName"
}
],
"sorting": [
{
"direction": "Ascending",
"name": "BillingMonth"
}
]
},
"includeMonetaryCommitment": false
},
"dateRange": "Last12Months",
"currency": "USD",
"chart": "StackedColumn",
"accumulated": "False",
"metric": "ActualCost",
"kpis": [
{
"type": "Budget",
"id": "COST_NAVIGATOR.BUDGET_OPTIONS.NONE",
"enabled": true
},
{
"type": "Forecast",
"id": null,
"enabled": true
}
],
"pivots": [
{
"type": "Dimension",
"name": "ServiceName"
},
{
"type": "Dimension",
"name": "ResourceLocation"
},
{
"type": "Dimension",
"name": "ResourceGroupName"
}
]
}
},```
Contributor
I have tried to set the granularity to Daily but the problem persists.
I manage to get the view I wanted by using the AzAPI resource as workaround
type = "Microsoft.CostManagement/views@2023-04-01-preview"
resource_id = azurerm_subscription_cost_management_view.yearly.id
body = jsonencode({
properties = {
dateRange = "Last12Months"
}
})
}
I manage to get the view I wanted by using the AzAPI resource as workaround
type = "Microsoft.CostManagement/views@2023-04-01-preview" resource_id = azurerm_subscription_cost_management_view.yearly.id body = jsonencode({ properties = { dateRange = "Last12Months" } }) }
Hello @cerocool1203, I have tried:
resource "azapi_resource" "example" {
name = "costview"
type = "Microsoft.CostManagement/views@2023-04-01-preview"
parent_id = azurerm_subscription_cost_management_view.example.id
body = jsonencode({
properties = {
dateRange = "Last12Months"
}
})
│ RESPONSE 404: 404 Not Found │ ERROR CODE UNAVAILABLE │ -------------------------------------------------------------------------------- │ The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. │ --------------------------------------------------------------------------------
Is there any solution on the issue? We are facing exactly the same issue
Hi @cerocool1203 ,
iam also getting the below error:
Any news about this?
Some people are facing the same issue and there is not any solution actually.
Thank you
Hi @tombuildsstuff, @katbyte, @mbfrahry
I wanted to follow up on this issue as it has been open for over a year without any updates. The problem still persists with the latest versions of Terraform and the azurerm provider.
Is there any update on this, or is there any additional information I can provide to help resolve this issue? Your assistance would be greatly appreciated.
Thank you for your attention and all your hard work on this project.
Best regards, Joel
Is there an existing issue for this?
Community Note
I have the following code to create a subscription cost management view: `resource "azurerm_subscription_cost_management_view" "subscription_cost_management_view" { name = "costview-${var.subscription_name}" display_name = "costview-${var.subscription_name}" chart_type = "StackedColumn" accumulated = false
subscription_id = "/subscriptions/${var.subscription_id}"
report_type = "Usage" timeframe = "YearToDate"
dataset { granularity = "Monthly"
} pivot { name = "ResourceId" type = "Dimension" }
pivot { name = "ResourceGroupName" type = "Dimension" }
pivot { name = "ServiceName" type = "Dimension" } }`
But when I go to this view, the timeframe is not YearToDate:
Terraform Version
1.5.5
AzureRM Provider Version
3.69.0
Affected Resource(s)/Data Source(s)
azurerm_subscription_cost_management_view
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
To see the costview with YearToDate timeframe
Actual Behaviour
The costview is just for the actual month
Steps to Reproduce
terraform apply
Important Factoids
No response
References
No response