Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cost management export export_data_options time frame does not support a documented value #21523

Closed
1 task done
thaliegf opened this issue Apr 24, 2023 · 3 comments · Fixed by #21528
Closed
1 task done

Comments

@thaliegf
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.4.5

AzureRM Provider Version

3.53.0

Affected Resource(s)/Data Source(s)

azurerm_subscription_cost_management_export

Terraform Configuration Files

provider "azurerm" {
  alias           = "video_cloud"
  features {}
}

variable "cost_management" {
  type = object({
    storage_account_name = string
    export_name = string
    root_folder = string  
  })
}

cost_management = {
        storage_account_name = "costmgmt"
        export_name = "TestExport"
        root_folder = "devExport"
        }

data "azurerm_subscription" "current" {}

resource "azurerm_storage_container" "weekly_report" {
  name                  = "weeklycostreport"
  storage_account_name  = "costexport"
  container_access_type = "private"
  lifecycle {
    prevent_destroy = true
  }
}

resource "azurerm_storage_container" "weekly_report" {
  provider = azurerm.video_cloud
  name                  = "test"
  storage_account_name  = "costexport"
  container_access_type = "private"
  lifecycle {
    prevent_destroy = true
  }
}

resource "azurerm_subscription_cost_management_export" "video_cloud_weekly" {
  provider = azurerm.video_cloud
  name                          = var.cost_management.export_name
  subscription_id               = data.azurerm_subscription.current.id
  recurrence_type               = "Weekly"
  recurrence_period_start_date  = "2023-04-24T00:00:00Z"
  recurrence_period_end_date    = "2050-02-01T00:00:00Z"

  export_data_storage_location {
    container_id        = azurerm_storage_container.weekly_report.resource_manager_id
    root_folder_path    = var.cost_management.root_folder
  }

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

Debug Output/Panic Output

Error: expected export_data_options.0.time_frame to be one of [Custom BillingMonthToDate TheLastBillingMonth TheLastMonth WeekToDate MonthToDate], got TheLastWeek
│
│   with module.logging_policies.azurerm_subscription_cost_management_export.video_cloud_weekly,
│   on ..\modules\logging-policies\main.tf line 150, in resource "azurerm_subscription_cost_management_export" "video_cloud_weekly":
│  150:     time_frame  = "TheLastWeek"

Expected Behaviour

Expect to create a cost management export with export type "Weekly export of last 7 days"

Actual Behaviour

Documentation mentions TheLastWeek should be a value for time_frame. However terraform plan fails when this value is provided.
image

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/billing_account_cost_management_export

Steps to Reproduce

terraform plan

Important Factoids

No response

References

No response

@myc2h6o
Copy link
Contributor

myc2h6o commented Apr 25, 2023

Hi @thaliegf thanks for opening the issue! The value in the document is actually wrong and should be TheLast7Days. Plus, this value is not in the Azure API swagger definition which is being tracked by Azure/azure-rest-api-specs#23707 thus it was not added to the provider code as well. I've opened #21528 to add the new option TheLast7Days

@github-actions github-actions bot added this to the v3.54.0 milestone Apr 25, 2023
@github-actions
Copy link

This functionality has been released in v3.54.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants